Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
unexpected cursor behavior while attempting to control tab order intextboxes and comboboxes on a spreadsheet. dan dungan Excel Programming 0 February 19th 09 10:24 PM
Transpose Column With Gaps to Column With no gaps Vincent Excel Discussion (Misc queries) 9 October 1st 07 01:50 PM
Gaps In Bin Locations Tiziano Excel Worksheet Functions 4 August 22nd 06 02:48 AM
variable gaps pytelium Excel Discussion (Misc queries) 1 October 17th 05 10:57 PM
Transpose Column With Gaps to Row With No Gaps? SteveC Excel Discussion (Misc queries) 5 June 18th 05 01:01 AM


All times are GMT +1. The time now is 01:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"