Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Insert cells at end of selection

Thanks,

The only problem I am finding is that it is inserting the new row, 2 rows
above the last row with data, not one

"Rick Rothstein" wrote:

This should do what you want, just assign the number of rows of cells in
Columns A through R to insert to the NumberOfBlankRows variable (I used 4
for my example code)...

Sub InsertBlankCellsColumnsAtoR()
Dim LastRow As Long, NumberOfBlankRows
NumberOfBlankRows = 4
LastRow = Range("A3:R1000").Find(What:="*", SearchOrder:=xlColumns, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row
Intersect(Range("A:R"), Rows(LastRow)).Resize(NumberOfBlankRows).Insert
End Sub

--
Rick (MVP - Excel)


"Kirsty" wrote in message
...
Hi,

I have a macro that I want to change to go look in a range of cells
A3:R1000
and find the last row with data.

I then want to step back and insert cells above this row.

Eg, i have data in row 140, so I want to insert cells to get a blank lot
of
cells in row 140 from columns A to R.

Is this possible?

Kirsty


.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Insert cells at end of selection

Sorry, have been having computer issues, but I have fixed the problem.

"Kirsty" wrote:

Thanks,

The only problem I am finding is that it is inserting the new row, 2 rows
above the last row with data, not one

"Rick Rothstein" wrote:

This should do what you want, just assign the number of rows of cells in
Columns A through R to insert to the NumberOfBlankRows variable (I used 4
for my example code)...

Sub InsertBlankCellsColumnsAtoR()
Dim LastRow As Long, NumberOfBlankRows
NumberOfBlankRows = 4
LastRow = Range("A3:R1000").Find(What:="*", SearchOrder:=xlColumns, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row
Intersect(Range("A:R"), Rows(LastRow)).Resize(NumberOfBlankRows).Insert
End Sub

--
Rick (MVP - Excel)


"Kirsty" wrote in message
...
Hi,

I have a macro that I want to change to go look in a range of cells
A3:R1000
and find the last row with data.

I then want to step back and insert cells above this row.

Eg, i have data in row 140, so I want to insert cells to get a blank lot
of
cells in row 140 from columns A to R.

Is this possible?

Kirsty


.

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
Selection copy and insert to other sheet VLOOKUP fORMULA Excel Discussion (Misc queries) 1 March 23rd 10 05:29 PM
Insert cells at end of selection Kirsty Excel Programming 0 November 17th 09 10:47 PM
Insert Row Selection VLOOKUP fORMULA Excel Worksheet Functions 2 June 19th 09 04:44 AM
Selection EntireRow Insert Rob Excel Programming 4 March 24th 08 08:32 PM
Insert Picture from dropdown selection Mike at Channel New Users to Excel 21 March 22nd 06 01:14 AM


All times are GMT +1. The time now is 07:27 AM.

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

About Us

"It's about Microsoft Excel"