Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting unexpected gaps in a spreadsheet
Not to worry I fixed it - many thanks
-- C Ward "christopher ward" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
unexpected cursor behavior while attempting to control tab order intextboxes and comboboxes on a spreadsheet. | Excel Programming | |||
Transpose Column With Gaps to Column With no gaps | Excel Discussion (Misc queries) | |||
Gaps In Bin Locations | Excel Worksheet Functions | |||
variable gaps | Excel Discussion (Misc queries) | |||
Transpose Column With Gaps to Row With No Gaps? | Excel Discussion (Misc queries) |