Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've come up with the code but I don't know why there is
any error message highlighted at Do While Not EOF(1) Line Input #1, data Worksheets("Sheet1").Activate Line: Cells(i, 1).Value = Mid(data, 1, 8) i=i +1 Loop |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Per you later post, I believe you haven't initialized the value of i prior
to entering the loop. Thus in the cells(i,1) line it would resolve to cells(0,1) which will give you an error. -- Regards, Tom Ogilvy "hallie" wrote in message ... I've come up with the code but I don't know why there is any error message highlighted at Do While Not EOF(1) Line Input #1, data Worksheets("Sheet1").Activate Line: Cells(i, 1).Value = Mid(data, 1, 8) i=i +1 Loop |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If i = 0 initially that will error. If so, put i = i + 1 before the Cells
line. Is there any reason to Activate Sheet1 in the loop? If not, put the activate before the loop. In fact, if you use: Worksheets("Sheet1").Cells(i, 1).Value = Mid(data, 1, 8) you do not an activate at all. -- Jim Rech Excel MVP "hallie" wrote in message ... | I've come up with the code but I don't know why there is | any error message highlighted at | | | Do While Not EOF(1) | Line Input #1, data | Worksheets("Sheet1").Activate | Line: Cells(i, 1).Value = Mid(data, 1, 8) | i=i +1 | Loop | | |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Tom & Jim ,
In fact I've initialized to i to 1 before the start of loop I've replaced my code with the line below... Worksheets("Whinv").Cells(i, 1).Value = Mid(data, 1, ) When I run , error stops at above line with same error code of 1004 Application defined or object defined error... But my excel column is populated with values with blanks rows in between certain rows eg.. A column Row1 data1 Row2 Row3 Row3 data2 Row4 Row5 data3 etc etc |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks to everyone for your suggrstion..
I've found out the cause .. It's my silly mistake. my counter increment was wrong. I treat "i" as 1.I'm not going to use i as a variable again... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Data from exported file read as text, when edited becomes a # (pic | Excel Discussion (Misc queries) | |||
Can a cell be linked to read data entered into a text box ? | Excel Discussion (Misc queries) | |||
Can a cell be linked to read data entered into a text box ? | Excel Discussion (Misc queries) | |||
Read data from a text file (*.txt) | Excel Programming | |||
Read/Write data to/from text files from a spreadsheet. | Excel Programming |