Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 154
Default Auto Increment Number

E_Dirksen,

I have created a macro for you. Please place this into a module inside of
VBA and run the Macro (ToolsMacroNumber_Range).
It can be amended to start at the active cell, but currently it will ask you
what Range and then what you want the starting number to be.

Sub Number_Range()
Dim xlssheet As Excel.Worksheet
Dim x As Long
Dim rng As String
Dim y As Long
Dim z As Long

Set xlssheet = Excel.ActiveSheet
x = 1
rng = InputBox("Enter Range (i.e. A1:A5)", "Range")
y = InputBox("Enter Starting Value", "Start")


xlssheet.Range(rng).Select
z = Selection.Cells.Count

For x = 1 To z
xlssheet.Cells(x, 1).Value = y
y = y + 1
Next

End Sub

"E_Dirksen" wrote:

Hello,

I've been trying to create a Macro that when a button is clicked, the cell
will place a number in the box and then move down one row in the same column.
I can ove the cell down a row but I need to be able to automatically
incrment the number by 1 each time. Can anyone help?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
suspend auto increment Bill Johnson Excel Discussion (Misc queries) 6 February 8th 08 06:26 PM
auto increment Trizzle Excel Discussion (Misc queries) 1 December 6th 06 09:14 PM
DP Auto increment [email protected] Excel Worksheet Functions 2 August 16th 06 12:37 AM
How to auto-number (increment) invoices in Excel? Pheasant Plucker® Excel Discussion (Misc queries) 1 September 8th 05 01:58 PM
how to auto increment a number each time i open the worksheet fred rondak Excel Worksheet Functions 1 June 25th 05 11:40 PM


All times are GMT +1. The time now is 04:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"