Hi,
I'm using Excel 2010. I have Sheet1 that contains eleven columns. Let's call this group of eleven columns LocationData.
On a Sheet2, I have one column for each LocationData group that summarizes the data using various formulas, referencing various columns in the group. All my formulas are setup for the first LocationData group using absolute references to Sheet1.
When I need to add additional LocationGroups, I have a macro that inserts the 11 columns into Sheet1.
I'd like to copy my single column in Sheet2 and replace the absolute column reference with an absolute reference to the column 11 columns to the right.
For example,
Would become:
I was hoping I could use something like this:
I could probably hard-code the $L, but I would rather do a pattern match of "$" plus 1-2 characters (absColRef) because there are several columns used across all my formulas. Is that possible?
Once I know the column characters, how do I increment them by a factor of 11?
Thanks for any guidance!
I'm using Excel 2010. I have Sheet1 that contains eleven columns. Let's call this group of eleven columns LocationData.
On a Sheet2, I have one column for each LocationData group that summarizes the data using various formulas, referencing various columns in the group. All my formulas are setup for the first LocationData group using absolute references to Sheet1.
When I need to add additional LocationGroups, I have a macro that inserts the 11 columns into Sheet1.
I'd like to copy my single column in Sheet2 and replace the absolute column reference with an absolute reference to the column 11 columns to the right.
For example,
Code:
=SUM(Sheet1!$L$77:$L$79,Sheet1!$L$71:$L$72,Sheet1!$L$73:$L$75)
Would become:
Code:
=SUM(Sheet1!$W$77:$W$79,Sheet1!$W$71:$W$72,Sheet1!$W$73:$W$75)
I was hoping I could use something like this:
Code:
ActiveCell.Offset(0, 0).Columns("A:A").EntireColumn.Replace What:=absColRef, Replacement:=colRefPlusEleven, LookAt:= _xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
I could probably hard-code the $L, but I would rather do a pattern match of "$" plus 1-2 characters (absColRef) because there are several columns used across all my formulas. Is that possible?
Once I know the column characters, how do I increment them by a factor of 11?
Thanks for any guidance!