make a loop for range

ganu learner

New Member
Joined
Dec 31, 2019
Messages
47
Office Version
  1. 2013
Platform
  1. Windows
Range("A15:L15").Value = Range("A16:L16").Value
Range("A16:L16").Value = Range("A17:L17").Value
Range("A17:L17").Value = Range("A18:L18").Value
Range("A18:L18").Value = Range("A19:L19").Value
Range("A19:L19").Value = Range("A20:L20").Value
Range("A20:L20").Value = Range("A21:L21").Value
Range("A21:L21").Value = Range("A22:L22").Value
Range("A22:L22").Value = Range("A23:L23").Value
Range("A23:L23").Value = Range("A24:L24").Value
Range("A24:L24").Value = Range("A25:L25").Value
Range("A25:L25").Value = Range("A26:L26").Value
Range("A26:L26").Value = Range("A27:L27").Value
Range("A27:L27").Value = Range("A30:L30").Value
Respected Sir please make a loop vba script for above condition.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Try this

VBA Code:
Public Sub test()
Dim i As Long
For i = 15 To 26
Range("A" & i).Resize(1, 12).Value = Range("A" & i + 1).Resize(1, 12).Value
Next i
Range("A27:L27").Value = Range("A30:L30").Value
End Sub
 
Upvote 0
Solution
Try this

VBA Code:
Public Sub test()
Dim i As Long
For i = 15 To 26
Range("A" & i).Resize(1, 12).Value = Range("A" & i + 1).Resize(1, 12).Value
Next i
Range("A27:L27").Value = Range("A30:L30").Value
End Sub
thankyou Sir ,working fine
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,196
Members
449,072
Latest member
DW Draft

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