Continuous Macro

hstsunflower

New Member
Joined
Sep 11, 2020
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Hi There,

Is it possible to create a Macro that will continue through the end of my worksheet and be useable on other worksheets even if the number of rows with data changes?

ie; my worksheet contains 13526 rows. I would like to create a macro that will do the following in the same column down thru row 13526:
Selection.End(xlDown).Select
Range("A122").Select
ActiveCell.FormulaR1C1 = "x"
Selection.End(xlDown).Select
Range("A124").Select
ActiveCell.FormulaR1C1 = "x"
Range("A125").Select

and continue down through all rows to the end of row 13526.

I would also like to use this macro in other worksheets however the number of rows will definitely vary.

Thanks in advance for your help.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi & welcome to MrExcel.
What are you trying to do?
 
Upvote 0
my worksheet contains 13526 rows. I would like to create a macro that will do the following in the same column down thru row 13526:
Selection.End(xlDown).Select
Range("A122").Select
ActiveCell.FormulaR1C1 = "x"
Selection.End(xlDown).Select
Range("A124").Select
ActiveCell.FormulaR1C1 = "x"
Range("A125").Select

and continue down through all rows to the end of row 13526.

I would also like to use this macro in other worksheets however the number of rows will definitely vary.
 
Upvote 0
That does not tell me what you are trying to do.
Please explain, in words, what you need.
 
Upvote 0
I would like my macro to end down in a column and place an X in every first row after the end. I would like this to be continued all the way down my spreadsheet.

I would like an X to be placed after every bold title all the way down to row 13526.

1599855697062.png
 
Upvote 0
Ok, thanks for that. How about
VBA Code:
Sub hstsunflower()
   Range("A:A").SpecialCells(xlConstants).Offset(1).Value = "x"
End Sub
If you can have 2 or more consecutive cells in col A that have a value, let me know as this will not work in that scenario.
 
Upvote 0
Awesome. Thank you. Where would I place this? Before the code above or after?
 
Upvote 0
It replaces all of your code.
 
Upvote 0
I appreciate your help.

Unfortunately, it's not working. it's filling the entire row with X's. I would like just the first row following the cell that has data to have an X inserted.

1600107237987.png
 
Upvote 0
What do you mean it's filling all the rows with an x?
Are the cells in col A actually empty?
 
Upvote 0

Forum statistics

Threads
1,215,222
Messages
6,123,706
Members
449,118
Latest member
MichealRed

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