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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
@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,790
Messages
6,121,607
Members
449,037
Latest member
Arbind kumar

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