Change attached code to affect the current highlighted row(s) when run?

Bret1

Board Regular
Joined
Jun 14, 2013
Messages
199
Hi,
Can you please help me change the attached code to affect only the current highlighted row(s)?
In this example, everywhere that row "741" is displayed, should be changed to whatever row is currently highlighted when macro is run... (or to whatever row the "A" column is selected - whichever is easier.)
Thanks!

Code:
Sub Macro1()
'
' Macro1 Macro
'
'
Rows("741:741").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A741:S741").Select
Selection.Delete Shift:=xlUp
Range("J741").Select
Selection.Copy
Range("V741").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.Panes(4).Activate
Range("KB741").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
 
You are welcome.
I am glad that we finally got it working the way you want.
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
@Joe4
Everything is working great with your code! I have realized one more thing that would complete the task that may be a very simple addition for you, so I'd like to ask...
After completing the code from #29....
Copy ("R17:S17") and paste down (“R:S”) until “V” is has 2 blanks in a row (this is end of data).
Then, if there is text in (“A”) greater than row A14, then Selection.ClearContents on that row (and the row above it) in (“R:S”)
Example: If (“A15”) has text, then ClearContents of R15,S15,R14,S14 (down until “V” has 2 blanks in a row is good stopping point).

Thank you!
 
Upvote 0
@Joe4
I stated the 2nd part and example incorrect....
Should be...... Example: If ("A15") has text, then ClearContents of R15, S15, R16, S16 ---- (R:S cleared on same row as "A" and on one row GREATER than that row).
 
Upvote 0
Everything is working great with your code! I have realized one more thing that would complete the task that may be a very simple addition for you, so I'd like to ask...
That is really a new question, so you are best to post it to a new thread.
In that new thread, you should post your current code, and the changes that you want to make to it.
Note that some users may want to see a sample of your data and expected output to.
 
Upvote 0

Forum statistics

Threads
1,214,840
Messages
6,121,895
Members
449,058
Latest member
Guy Boot

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