Macros

ironsides

Well-known Member
Joined
Aug 12, 2002
Messages
575
I use a lot of macros. Occasionally after setting up a new sheet with macros I find that I neglected to include a field in my sheet. After I add that field, I have to manually change every macro that contains a field to the right of that newly inserted field. Is there a better way? Im using Excel 2000. Does the latest version overcome this? Thanks
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
I suppose we'd really have to see your code and what your definition of a "field" is.

Smitty
 
Upvote 0
Field is a column

Here are 2 typical codes:

Sub GIZ()
'
' GIZ Macro
' Macro recorded 10/8/2006 by USER
'
' Keyboard Shortcut: Ctrl+Shift+G
'
Selection.Sort Key1:=Range("n7"), Order1:=xlAscending, Key2:=Range("p7") _
, Order2:=xlAscending, Key3:=Range("q7"), Order3:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

And


Sub SpG()
'
' Spacer Macro
' Macro recorded 5/23/2006 by USER
'
' Keyboard Shortcut: Ctrl+q
'

'
' SpG Macro
' Macro recorded 5/23/2006 by USER
'
' Keyboard Shortcut: Ctrl+q
'

Dim i As Long
For i = Range("b65536").End(xlUp).Row To 5 Step -1
If Cells(i, 14) <> Cells(i - 1, 14) Then Rows(i).EntireRow.Insert
Next i

End Sub
 
Upvote 0
Another idea (after learning what Paddy & Tushar are trying to show you here of course) :wink:
might be to look into using named ranges and referring to them in your code instead of
using fixed range references.
 
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,387
Members
448,957
Latest member
Hat4Life

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top