PDA

View Full Version : [SOLVED:] How to add row in second Sheet using ActiveCell in first sheet?



asktheages
12-19-2022, 05:49 AM
Hello.

I have two exactly the same sheets, but one in my national language, and one in English. I've made a macro that adds a row under ActiveCell and pastes the formulas needed there.
The problem i have - it doesnt affect the English sheet. And i need it mirrored... Absolutely no idea how to do it! Could you please help me?

Here's the code i use. It's pretty strange, because i had to work around some problems (xldown wouldnt bring me to the last cell)

ActiveCell.Offset(1, 0).EntireRow.Insert
Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(0, 5)).Copy
ActiveCell.Offset(1, 1).PasteSpecial (xlPasteFormulas)
Application.CutCopyMode = False
ActiveCell.Offset(0, -1).Select

The real problem is... Excel doesnt know where to begin in the Second sheet. It doesnt mirror the ActiveCell address from first sheet, and i have no idea how to tell him this...

Thanks!

asktheages
12-19-2022, 06:52 AM
Okay, i found solution on my own. To anyone that might need this answer:

Dim s As String
s = ActiveCell.Address


ActiveCell.Select
Worksheets(3).Activate
Range(s).Select

Solved