Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting Rows


Hi,

I have a sheet that has blank rows at the beginning of the spreadsheet.
For example this week rows 1 thru 3 are empty before data is entered in
Row 4. Last week rows 1 thru 8 were empty and sometimes there are no
empty rows before data is entered (Data in row 1).

Since the number of empty rows varies each month, is there a way to
delete the entire empty row(s), if any, before data is entered in
column A.

Any help would be greatly appreciated!


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=483143

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Deleting Rows

Dim rng as Range
on error resume next
set rng = columns(1).specialcells(xlblanks)
On error goto 0
if not rng is nothing then
if rng.Row = 1 then
rng.Areas(1).EntireRow.Delete
end if
end if

--
Regards,
Tom Ogilvy


"STEVEB" wrote in
message ...

Hi,

I have a sheet that has blank rows at the beginning of the spreadsheet.
For example this week rows 1 thru 3 are empty before data is entered in
Row 4. Last week rows 1 thru 8 were empty and sometimes there are no
empty rows before data is entered (Data in row 1).

Since the number of empty rows varies each month, is there a way to
delete the entire empty row(s), if any, before data is entered in
column A.

Any help would be greatly appreciated!


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile:

http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=483143



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting Rows


Hi Tom,

Thanks for your help, I appreciate it!

I tried your example & the active cell moves to A1, however, it doe
not delete rows 1-3. Have I missed something?

Thank

--
STEVE
-----------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...nfo&userid=187
View this thread: http://www.excelforum.com/showthread.php?threadid=48314

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting Rows


Tom,


I hope this helps:

The code worked when I "cleared the contents" rows 1-3, prior to
running the Macro. The reason the # of rows empty changes each week is
due to downloading various data. Is this an issue?

Even though there is no data in rows 1-3, for some reason, Excel is
recognizing the cells as "not blank".

Do you have any sugesstions? Thanks again!!


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=483143

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Deleting Rows

You said they were blank, but apparently you are pasting something into them
so they are not blank.

You can probably use something like

Sub DeleteRows()
Do While Len(Trim(Range("A1"))) = 0
Rows(1).Delete
Loop
End Sub

--
Regards,
Tom Ogilvy




"STEVEB" wrote in
message ...

Tom,


I hope this helps:

The code worked when I "cleared the contents" rows 1-3, prior to
running the Macro. The reason the # of rows empty changes each week is
due to downloading various data. Is this an issue?

Even though there is no data in rows 1-3, for some reason, Excel is
recognizing the cells as "not blank".

Do you have any sugesstions? Thanks again!!


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile:

http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=483143





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting Rows


Thanks Tom,

Everything worked great! I really appreciate your help!!!


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=483143

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
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Links and Linking in Excel 1 November 13th 08 08:44 AM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Setting up and Configuration of Excel 1 November 12th 08 06:05 PM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Excel Worksheet Functions 1 November 12th 08 01:39 PM
Help!! I have problem deleting 2500 rows of filtered rows!!!! shirley_kee Excel Discussion (Misc queries) 1 January 12th 06 03:24 AM
deleting hidden rows so i can print only the rows showing?????? jenn Excel Worksheet Functions 0 October 6th 05 04:05 PM


All times are GMT +1. The time now is 01:20 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"