The problem is:
When you insert a row in your table, column "D" doesn't "inherit" the 
properties of the previous row, but instead reverts to the "General" format of 
the rest of the column.
 
There's a couple ways of handling this.
I tried both and they both seem to work:
 
Select the entire column "D" and change the format to "Text".
 
add this statement:

    Worksheets("BankData").Cells(NewRow, 4).NumberFormat = "@"

(prior to:
    Worksheets("BankData").Cells(NewRow, 4).Value = ano


(I found this by recording a macro, in which I changed the cell format to 
"Text")


also:

in your macro, when you're looking for a blank row, there's LOTS of ways to do 
this, of course, but your loop should look more like:


    For NewRow = 5 To 1000
        If Worksheets("BankData").Cells(NewRow, "A").Value = "" Then
            Exit For
        End If
    Next NewRow

hope this helps,

Paul
-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-----------------------------------------

 From: Ashish Bhalara <ashishbhalar...@gmail.com>
>To: excel-macros@googlegroups.com 
>Sent: Tuesday, February 3, 2015 1:02 AM
>Subject: $$Excel-Macros$$ problem in code fpr data copied from text to number 
>format
>  
>
>
>Dear experts,
>
>
>Please see attached file in which account no. field is text format but copied 
>in number format. Problem is that when I type 0123, data copied at 123 as per 
>my coding, I also try by define variable as string but problem same as 
>standing.
>
>
>Please edit my code to solve this issue.
>
>
>Regards.
>Ashish Bhalara
>9624111822
>PPlease do not print this email unless it is absolutely necessary. Spread
environmental üawareness.♣♣♣
>
> 
-- 
>Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
>=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
>https://www.facebook.com/discussexcel
> 
>FORUM RULES
> 
>1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
>Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
>quick attention or may not be answered.
>2) Don't post a question in the thread of another member.
>3) Don't post questions regarding breaking or bypassing any security measure.
>4) Acknowledge the responses you receive, good or bad.
>5) Jobs posting is not allowed.
>6) Sharing copyrighted material and their links is not allowed.
> 
>NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
>members are not responsible for any loss.
>--- 
>You received this message because you are subscribed to the Google Groups "MS 
>EXCEL AND VBA MACROS" group.
>To unsubscribe from this group and stop receiving emails from it, send an 
>email to excel-macros+unsubscr...@googlegroups.com.
>To post to this group, send email to excel-macros@googlegroups.com.
>Visit this group at http://groups.google.com/group/excel-macros.
>For more options, visit https://groups.google.com/d/optout.
>
>
>    

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to