With ActiveCell, manipulate dynamic range down and to the right of ActiveCell

Hanret

New Member
Joined
Aug 25, 2013
Messages
15
I'm trying to replace a formula in a few rows beneath a specific cell, which is in a different position every time the main macro is run.

The position of the ActiveCell as well as the range in which the formula needs to be replaced varies every time the macro is run.

I can successfully locate the ActiveCell dynamically and clear the contents of part of the row in which the ActiveCell is located, but I cannot successfully replace the formula in the data range beneath the ActiveCell.

Herewith my code that I have tried:
Code:
    'Clear contents of row with 'MCA Group' heading from Col B to last column with data
    Cells.Find(What:="MCA Group", After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
        SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate
    ActiveCell.Offset(, 1).Resize(, 21).ClearContents                     'Note: Range DIFFERS across all countries

Range(ActiveCell, Cells(Rows.Count, ActiveCell.End(xlToRight).Column).End(xlUp)).Select
           
    For Each cell In Selection
        cell.Formula = Replace(cell.Formula, "Detail!$C:$C", "Detail!$B:$B")
    Next cell
 
Last edited:

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
I'm quite intrigued that there seems to be no assistance with my query. If I get no response, what would be a reasonable time to wait before cross-posting to a different forum?
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

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