VBA Code for pasting Value every nth cell in 2 different rows

Reefbreaker

New Member
Joined
Mar 22, 2024
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi there,

I'm a bit stuck on some VBA code and need some help!

I want to create some code for a macro button that will auto populate a value from cell A1 in cells Q19 and AJ19 and carry on doing this every 14 cells in both columns.
It would be great if the VBA loop ends at row 355 as this is where the data finishes.

Cheers,
R
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Can you create a sample dataset with desired output?
 
Upvote 0
Maybe...

VBA Code:
Sub jec()
 Dim j As Long
 For j = 19 To 355 Step 14
    Union(Cells(j, 17), Cells(j, 36)) = [a1]
 Next
End Sub
 
Upvote 1
Solution
Hi,

Does this help at all? I'm currently away from my work laptop so just made a quick mock up at home.

Cheers
 

Attachments

  • Screenshot 2024-03-22 at 19.18.52-min.png
    Screenshot 2024-03-22 at 19.18.52-min.png
    81.8 KB · Views: 19
Upvote 0
Yes, you should try the code ;)
 
Upvote 0
Maybe stupid question, although quite new to VBA... What should I place instead of the j's?
 
Upvote 0
This code works fine here though...
Run it as is, on the sheet you showed
 
Upvote 0
Great, I'm back at work and it works perfectly - just like you said! Thanks so much for the help :)
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

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