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

Hello from Steved

I've got a problem and that is when I insert a Row My ranges Set myRng =
Me.Range("A10:A10") will not change ie to Set myRng = Me.Range("A11:A11"),

Is their something I can do as now I've got to go and change every range by 1.
I would like to avoid this in other wordswhen I insert a row the range will
change .
Thankyou.

Private Sub CommandButton1_Click()
Dim myRng As Range
Set myRng = Me.Range("A10:A10")
myRng.EntireRow.Hidden = Not (myRng(1).EntireRow.Hidden)
End Sub

Private Sub CommandButton10_Click()
Dim myRng As Range
Set myRng = Me.Range("A63:A64")
myRng.EntireRow.Hidden = Not (myRng(1).EntireRow.Hidden)
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default Inserting rows

Sorry but at this point there is no easy solution. What you can do is create
a named range for A10 (which is now A11 I assume) and then do a find and
replace in your code for every instance of A10. Now if you move the ranges
around again the code will move with the range name and all should be well.
--
HTH...

Jim Thomlinson


"Steved" wrote:

Hello from Steved

I've got a problem and that is when I insert a Row My ranges Set myRng =
Me.Range("A10:A10") will not change ie to Set myRng = Me.Range("A11:A11"),

Is their something I can do as now I've got to go and change every range by 1.
I would like to avoid this in other wordswhen I insert a row the range will
change .
Thankyou.

Private Sub CommandButton1_Click()
Dim myRng As Range
Set myRng = Me.Range("A10:A10")
myRng.EntireRow.Hidden = Not (myRng(1).EntireRow.Hidden)
End Sub

Private Sub CommandButton10_Click()
Dim myRng As Range
Set myRng = Me.Range("A63:A64")
myRng.EntireRow.Hidden = Not (myRng(1).EntireRow.Hidden)
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 519
Default Inserting rows

Hello Jim

Thankyou.

"Jim Thomlinson" wrote:

Sorry but at this point there is no easy solution. What you can do is create
a named range for A10 (which is now A11 I assume) and then do a find and
replace in your code for every instance of A10. Now if you move the ranges
around again the code will move with the range name and all should be well.
--
HTH...

Jim Thomlinson


"Steved" wrote:

Hello from Steved

I've got a problem and that is when I insert a Row My ranges Set myRng =
Me.Range("A10:A10") will not change ie to Set myRng = Me.Range("A11:A11"),

Is their something I can do as now I've got to go and change every range by 1.
I would like to avoid this in other wordswhen I insert a row the range will
change .
Thankyou.

Private Sub CommandButton1_Click()
Dim myRng As Range
Set myRng = Me.Range("A10:A10")
myRng.EntireRow.Hidden = Not (myRng(1).EntireRow.Hidden)
End Sub

Private Sub CommandButton10_Click()
Dim myRng As Range
Set myRng = Me.Range("A63:A64")
myRng.EntireRow.Hidden = Not (myRng(1).EntireRow.Hidden)
End Sub

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
inserting rows inbetween rows of data ? Azeem Excel Discussion (Misc queries) 1 October 27th 09 07:38 AM
Copying & Inserting Rows w/o Affecting other Rows Etc. LRay67 Excel Worksheet Functions 1 October 22nd 08 02:10 AM
Inserting Blank rows after every row upto 2500 rows Manju Excel Worksheet Functions 8 August 22nd 06 12:54 PM
Inserting multiple rows in excel with data in consecutive rows technotronic Excel Programming 2 October 20th 05 03:12 PM
Locking Inserting of Rows at certain rows? Joe HM Excel Programming 3 March 14th 05 12:34 PM


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