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

Bret1

Board Regular
Joined
Jun 14, 2013
Messages
157
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
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
59,112
Office Version
  1. 365
Platform
  1. Windows
You are welcome.
I am glad that we finally got it working the way you want.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Bret1

Board Regular
Joined
Jun 14, 2013
Messages
157
@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!
 

Bret1

Board Regular
Joined
Jun 14, 2013
Messages
157
@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).
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
59,112
Office Version
  1. 365
Platform
  1. Windows
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.
 

Forum statistics

Threads
1,141,871
Messages
5,709,097
Members
421,614
Latest member
RAB29

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
Top