How to Fill in column A serinumber contious until lastrow in column B blank

nhnn1986

Board Regular
Joined
Oct 12, 2017
Messages
92
Hi all

I have workbook.sheet(data) that data from Column B10:H with last row variable
Now I want put serinumber continous in column A: Cell(A10).value = 1 then continous until lastrow in column B is blank

Please help me to do that by VBA code.

Thanks./.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Try
Code:
Sub FillMe()
   Range("A1").Value = 1
   Range("a1").AutoFill Range("A1", Range("B" & Rows.Count).End(xlUp).Offset(, -1)), xlFillSeries
End Sub
 
Upvote 0
thanks for your code but my first range(A10).value = 1, not in range(A1).

Could you repair this code, i'm not good at excel VBA.

thanks./.
 
Upvote 0
Try
Code:
Sub FillMe()
   Range("A10").Value = 1
   Range("A10").AutoFill Range("A10", Range("B" & Rows.Count).End(xlUp).Offset(, -1)), xlFillSeries
End Sub
You know my penchant for one-liners, right? :lol:
Code:
[table="width: 500"]
[tr]
	[td]Sub FillMe()
  Range("A10", Cells(Rows.Count, "B").End(xlUp).Offset(, -1)) = Evaluate("ROW(1:" & Rows.Count & ")")
End Sub[/td]
[/tr]
[/table]
 
Upvote 0

Forum statistics

Threads
1,225,767
Messages
6,186,906
Members
453,386
Latest member
testmaster

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