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

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
I suppose we'd really have to see your code and what your definition of a "field" is.

Smitty
 

ironsides

Well-known Member
Joined
Aug 12, 2002
Messages
575
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
 

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,454
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.
 

Forum statistics

Threads
1,136,519
Messages
5,676,333
Members
419,619
Latest member
jalme

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
Top