Selecting Every Nth Cell by Column

VBANate

New Member
Joined
May 7, 2015
Messages
16
Hey Guys,

Is there a way to write a macro in VBA to select every nth cell by column?

Also, is there one to select every nth row by column?

Thanks,

Nate
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Yes, but it's rarely necessary to select cells to perform actions on them...
Code:
Sub Macro1()

Dim i As Long


Application.ScreenUpdating = False


For i = 1 To 100 Step 10
    Cells(1, i) = i
Next i


Application.ScreenUpdating = True


End Sub
 
Upvote 0
Yes, but it's rarely necessary to select cells to perform actions on them...
Code:
Sub Macro1()

Dim i As Long


Application.ScreenUpdating = False


For i = 1 To 100 Step 10
    Cells(1, i) = i
Next i


Application.ScreenUpdating = True


End Sub

Thanks a lot!
 
Upvote 0
Yes, but it's rarely necessary to select cells to perform actions on them...
Code:
Sub Macro1()

Dim i As Long


Application.ScreenUpdating = False


For i = 1 To 100 Step 10
    Cells(1, i) = i
Next i


Application.ScreenUpdating = True


End Sub
I just tested your code and found that it does not select every nth cell. It numbers them.
ea4n78.png
 
Upvote 0
Yes,the sample of code I posted was to demonstrate that you don't need to select cells to performactions on them
 
Upvote 0
Unfortunately, I need a code that can select every Nth Cell by column.

For example, D1, D3, D5, D7, ..., D10001
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,208
Members
448,554
Latest member
Gleisner2

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