View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
christopher ward christopher ward is offline
external usenet poster
 
Posts: 59
Default Getting unexpected gaps in a spreadsheet

Hi All

I wonder if I might ask a question. If you take the time to answer I thank
you in advance. I have written some VBA code and am getting blank lines in my
results between the data lines I expect. The snip of code which is in error
is -

If col1 < "" Then
ActiveWorkbook.Close
Sheets("Data").Select
Lastrowdata = ActiveSheet.UsedRange.Rows.Count

nudge = nudge + 1
Worksheets("Data").Cells(Lastrowdata + nudge, 1).Value =
col1

Workbooks.Open Filename:=sPath & sFile
End If

The sheet data ends up looking like this with the extra gaps -


Finance 1 A
Finance 1 B

Finance 1 C


Finance 1 D



Finance 3 A




Finance 3 B





Finance 3 C






Finance 2 A

Hence lots of gaps which I do not want. How do I get rid of them or detect
the last data row correctly. All my data is in the sheet but I want it row
after row as such.

--
C Ward