VBA+CODE for Loop for Rows (from 1 to 12 numbes)

vangoori

New Member
Joined
Sep 4, 2014
Messages
6
Hi Team,

I am trying to paste values from ("J1:U1") ....numbers like 1 to 12

i wrote code when i am trying to excute that i am geeting error

Sub ColorCells1()
Dim myRange As Range
Set myRange = Range("A1:U1")
For i = 1 To 12
Rows(i, 13) = i
Next i
End Sub


thanks,
Shekar.
 

Some videos you may like

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

bbott

Well-known Member
Joined
Feb 5, 2010
Messages
2,350
Try changing Rows to Cells. Does that fix your issue?
Code:
Sub ColorCells1()
Dim myRange As Range
Set myRange = Range("A1:U1")
For i = 1 To 12
[COLOR=#ff0000][B]Cells[/B][/COLOR](i, 13) = i
Next i
End Sub

I'm not exactly sure what you're trying to accomplish. The first two rows of your code don't do anything.
 

vangoori

New Member
Joined
Sep 4, 2014
Messages
6
Hi,

Just i need 1 to 12 numbers from J1 to U1...

am i clear now

thanks,
Vangoori,
 

Watch MrExcel Video

Forum statistics

Threads
1,108,491
Messages
5,523,255
Members
409,506
Latest member
reneekeane

This Week's Hot Topics

Top