Import Problem

W

wmureports

I am importing data from a lot of .xls files(over 100). The data
imports and goes to the apprioriate location. The problem I am
encountering is that I get blank rows. My spreadsheet will look
similar to this

ID Name Phone
1 Joe 555-5555
2 Joe 555-5555
3 Joe 555-5555


4 Joe 555-5555
5 Joe 555-5555

6 Joe 555-5555

7 Joe 555-5555
8 Joe 555-5555
9 Joe 555-5555

Like that with random empty rows. What would i add to my macro to
ignore rows that are blank???
 
J

jetted

Hi wnureport

You have 2 choices;
1: You can do a sort first
2: You can do a macro
Sub test()
rowcount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
For i = 2 To rowcount
check_val = Range("a" & i).Value
If check_val <> Empty Then
'do something
End If
Next
End Sub
 
J

jetted

Hi wnureport

You have 2 choices;
1: You can do a sort first
2: You can do a macro
Sub test()
rowcount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
For i = 2 To rowcount
check_val = Range("a" & i).Value
If check_val <> Empty Then
'do something
End If
Next
End Sub
 
J

jetted

Hi wnureport

You have 2 choices;
1: You can do a sort first
2: You can do a macro
Sub test()
rowcount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
For i = 2 To rowcount
check_val = Range("a" & i).Value
If check_val <> Empty Then
'do something
End If
Next
End Su
 
T

Tim Williams

Where are the blank rows coming from?
Without knowing the source it's difficult to suggest a fix...
Posting code always helps.
 
W

wmureports

The blank rows are coming from the imported xls files. Each file has a
set number of rows, even if the rows are blank. So its copying all the
rows even if they are blank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top