Assign Serial Number in Excel like 1,1,2,2,3,3, and so on

DHYADAV

New Member
Joined
Oct 28, 2018
Messages
2
Hi everyone.

[FONT=verdana, geneva, lucida, lucida grande, arial, helvetica, sans-serif]want to assign serial number in column A like 1,1,2,2,3,3 and like

[/FONT]using following vba code but asssign serial number like 1,2,3, and like


Sub FillSerialNumbers()
With Range("A3:A" & Range("B" & Rows.Count).End(xlUp).Row)
.Cells(1, 1).Value = 1
.DataSeries Rowcol:=xlColumns, Type:=xlLinear, Step:=1, Trend:=False
End With
End Sub




Any ideas? I'm sure it's a minor error but I'm really stumped!!

Thanks in advance,

Dharmesh
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Give this macro a try...
Code:
[table="width: 500"]
[tr]
	[td]Sub FillSerialNumbers()
  With Range("A1:A" & Range("B" & Rows.Count).End(xlUp).Row)
    .Value = Evaluate("IF({1},INT((1+ROW(" & .Address & "))/2))")
  End With
End Sub[/td]
[/tr]
[/table]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
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