ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Return to range (https://www.excelbanter.com/excel-programming/298502-return-range.html)

gavmer[_8_]

Return to range
 
Hello,

I am using the following code that deletes rows in a range.

This range expands as info is added. A user clicks a button to have th
rows that were inserted deleted however, when performed, the range i
deleted. What i need is for the range to not actually be deleted bu
for the inserted rows to beleted/removed and for the range to revert t
normal.

Can someone please assist??

Sheets("TEMP").Range("pricing").Delete Shift:=xlShiftU

--
Message posted from http://www.ExcelForum.com


Chris

Return to range
 
I can't see how there is anyway progromatically to determine what the "Original" size of your named Range was

----- gavmer wrote: ----

Hello

I am using the following code that deletes rows in a range.

This range expands as info is added. A user clicks a button to have th
rows that were inserted deleted however, when performed, the range i
deleted. What i need is for the range to not actually be deleted bu
for the inserted rows to beleted/removed and for the range to revert t
normal

Can someone please assist?

Sheets("TEMP").Range("pricing").Delete Shift:=xlShiftU


--
Message posted from http://www.ExcelForum.com



gavmer

Return to range
 
Understood. Are you able to suggest an alternative?? rows 20-24 are blank. range is rows 21-22. data pastes into row 21 and expands up to 100 rows. When finalised, a user clicks to have the expanded range revert to original (hopefully) so that the sheet may be used again from scratch. How else may i do this???? Any ideas??

Cheers!!!

----- chris wrote: ----

I can't see how there is anyway progromatically to determine what the "Original" size of your named Range was

----- gavmer wrote: ----

Hello

I am using the following code that deletes rows in a range.

This range expands as info is added. A user clicks a button to have th
rows that were inserted deleted however, when performed, the range i
deleted. What i need is for the range to not actually be deleted bu
for the inserted rows to beleted/removed and for the range to revert t
normal

Can someone please assist?

Sheets("TEMP").Range("pricing").Delete Shift:=xlShiftU


--
Message posted from http://www.ExcelForum.com



Chris

Return to range
 
This should do the trick

Private Sub DelXtrRws (
Dim Rng as Range, x as Singl
Set rng = ActiveSheet.Range("YourRangeName")
x = rng.Rows.Count - 2
if x <= 0 then Exit Su
rng.Offset(2, 0).Resize(x).EntireRow.Delet
End Sub
----- gavmer wrote: ----

Understood. Are you able to suggest an alternative?? rows 20-24 are blank. range is rows 21-22. data pastes into row 21 and expands up to 100 rows. When finalised, a user clicks to have the expanded range revert to original (hopefully) so that the sheet may be used again from scratch. How else may i do this???? Any ideas??

Cheers!!!

----- chris wrote: ----

I can't see how there is anyway progromatically to determine what the "Original" size of your named Range was

----- gavmer wrote: ----

Hello

I am using the following code that deletes rows in a range.

This range expands as info is added. A user clicks a button to have th
rows that were inserted deleted however, when performed, the range i
deleted. What i need is for the range to not actually be deleted bu
for the inserted rows to beleted/removed and for the range to revert t
normal

Can someone please assist?

Sheets("TEMP").Range("pricing").Delete Shift:=xlShiftU


--
Message posted from http://www.ExcelForum.com



gavmer[_9_]

Return to range
 
great!!! Ill give it a shot. How do i set it to run on a worksheet name
'summary'??

Cheers!!!

--
Message posted from http://www.ExcelForum.com



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com