Guest_imported
New member
- Jan 1, 1970
- 0
I am new to this, and trying to write a short program to take a text file input, with lines of text, and delete all of those lines from my spreadsheet. for example, if i had a spreadsheet with the following data in a column:
1
2
3
4
5
and a .txt file with the following contents:
1
2
5
I'd want the program to delete the rows in the spreadhseet containing 1, 2 and 5, leaving only the rows that had contained 3 and 4.
this is what i got, which doesn't work:
sub macro1()
dim data as string
dim x as long
open "c:\data.txt" for input as #1
while not EOF(1)
line input #1, data
for x = 1 to 10 'check 10 rows
if cells (x,1) = data then
selection.rows(x).entirerow.delete
end if
next
wend
close #1
end sub
can anyone help me to get this to work? thanks for any help!
-Mike
1
2
3
4
5
and a .txt file with the following contents:
1
2
5
I'd want the program to delete the rows in the spreadhseet containing 1, 2 and 5, leaving only the rows that had contained 3 and 4.
this is what i got, which doesn't work:
sub macro1()
dim data as string
dim x as long
open "c:\data.txt" for input as #1
while not EOF(1)
line input #1, data
for x = 1 to 10 'check 10 rows
if cells (x,1) = data then
selection.rows(x).entirerow.delete
end if
next
wend
close #1
end sub
can anyone help me to get this to work? thanks for any help!
-Mike