Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How do you create a macro to auto number in excel 2003

I would like to have excel auto number a new work sheet every time I print a
new sheet. The form that I have created has the page numbers in cell I3 and
only has to number from 7 to infinity.
--
Matt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How do you create a macro to auto number in excel 2003

I'd create a dedicated macro and then put a button from the Forms toolbar onto
that sheet and assign the macro to this button.

Option Explicit
sub PrintMe()
with activesheet
if isnumeric(.range("I3").value) then
.range("I3").value = .range("I3").value + 1
.printout preview:=true
else
Beep
msgbox "I3 isn't a number!"
end if
end with
end sub

mceder1 wrote:

I would like to have excel auto number a new work sheet every time I print a
new sheet. The form that I have created has the page numbers in cell I3 and
only has to number from 7 to infinity.
--
Matt


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How do you create a macro to auto number in excel 2003

Dave
I created a button and copied your code from below. I guess that I dont
know how to put the button on the workbook.
--
Matt


"Dave Peterson" wrote:

I'd create a dedicated macro and then put a button from the Forms toolbar onto
that sheet and assign the macro to this button.

Option Explicit
sub PrintMe()
with activesheet
if isnumeric(.range("I3").value) then
.range("I3").value = .range("I3").value + 1
.printout preview:=true
else
Beep
msgbox "I3 isn't a number!"
end if
end with
end sub

mceder1 wrote:

I would like to have excel auto number a new work sheet every time I print a
new sheet. The form that I have created has the page numbers in cell I3 and
only has to number from 7 to infinity.
--
Matt


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How do you create a macro to auto number in excel 2003

Put the code in a general module--not behind the worksheet and not behind the
ThisWorkbook module.

Then show the Forms toolbar.
Plop a button from that toolbar onto the worksheet.

You'll be prompted to assign the macro--choose this macro.

If you have a button from the Forms toolbar already on the worksheet, you can
rightclick on it and choose Assign Macro.

Remember that this is the button from the Forms toolbar--not the commandbutton
from the Control toolbox toolbar.

mceder1 wrote:

Dave
I created a button and copied your code from below. I guess that I dont
know how to put the button on the workbook.
--
Matt

"Dave Peterson" wrote:

I'd create a dedicated macro and then put a button from the Forms toolbar onto
that sheet and assign the macro to this button.

Option Explicit
sub PrintMe()
with activesheet
if isnumeric(.range("I3").value) then
.range("I3").value = .range("I3").value + 1
.printout preview:=true
else
Beep
msgbox "I3 isn't a number!"
end if
end with
end sub

mceder1 wrote:

I would like to have excel auto number a new work sheet every time I print a
new sheet. The form that I have created has the page numbers in cell I3 and
only has to number from 7 to infinity.
--
Matt


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How do you create a macro to auto number in excel 2003


-- I donot get a assign macro command. I may not be getting to the right
forms command. I am new to macros if you couldnt tell
Matt


"Dave Peterson" wrote:

Put the code in a general module--not behind the worksheet and not behind the
ThisWorkbook module.

Then show the Forms toolbar.
Plop a button from that toolbar onto the worksheet.

You'll be prompted to assign the macro--choose this macro.

If you have a button from the Forms toolbar already on the worksheet, you can
rightclick on it and choose Assign Macro.

Remember that this is the button from the Forms toolbar--not the commandbutton
from the Control toolbox toolbar.

mceder1 wrote:

Dave
I created a button and copied your code from below. I guess that I dont
know how to put the button on the workbook.
--
Matt

"Dave Peterson" wrote:

I'd create a dedicated macro and then put a button from the Forms toolbar onto
that sheet and assign the macro to this button.

Option Explicit
sub PrintMe()
with activesheet
if isnumeric(.range("I3").value) then
.range("I3").value = .range("I3").value + 1
.printout preview:=true
else
Beep
msgbox "I3 isn't a number!"
end if
end with
end sub

mceder1 wrote:

I would like to have excel auto number a new work sheet every time I print a
new sheet. The form that I have created has the page numbers in cell I3 and
only has to number from 7 to infinity.
--
Matt

--

Dave Peterson


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How do you create a macro to auto number in excel 2003

Delete that button (I think you used the wrong one)

Then View|Toolbars|show the Forms toolbar
And use the button from that toolbar.



mceder1 wrote:

-- I donot get a assign macro command. I may not be getting to the right
forms command. I am new to macros if you couldnt tell
Matt

"Dave Peterson" wrote:

Put the code in a general module--not behind the worksheet and not behind the
ThisWorkbook module.

Then show the Forms toolbar.
Plop a button from that toolbar onto the worksheet.

You'll be prompted to assign the macro--choose this macro.

If you have a button from the Forms toolbar already on the worksheet, you can
rightclick on it and choose Assign Macro.

Remember that this is the button from the Forms toolbar--not the commandbutton
from the Control toolbox toolbar.

mceder1 wrote:

Dave
I created a button and copied your code from below. I guess that I dont
know how to put the button on the workbook.
--
Matt

"Dave Peterson" wrote:

I'd create a dedicated macro and then put a button from the Forms toolbar onto
that sheet and assign the macro to this button.

Option Explicit
sub PrintMe()
with activesheet
if isnumeric(.range("I3").value) then
.range("I3").value = .range("I3").value + 1
.printout preview:=true
else
Beep
msgbox "I3 isn't a number!"
end if
end with
end sub

mceder1 wrote:

I would like to have excel auto number a new work sheet every time I print a
new sheet. The form that I have created has the page numbers in cell I3 and
only has to number from 7 to infinity.
--
Matt

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How do you create a macro to auto number in excel 2003

Dave
got the button to work. Now I get an error that states Compile error:
expected : end of statement. What is this?
--
Matt


"Dave Peterson" wrote:

Delete that button (I think you used the wrong one)

Then View|Toolbars|show the Forms toolbar
And use the button from that toolbar.



mceder1 wrote:

-- I donot get a assign macro command. I may not be getting to the right
forms command. I am new to macros if you couldnt tell
Matt

"Dave Peterson" wrote:

Put the code in a general module--not behind the worksheet and not behind the
ThisWorkbook module.

Then show the Forms toolbar.
Plop a button from that toolbar onto the worksheet.

You'll be prompted to assign the macro--choose this macro.

If you have a button from the Forms toolbar already on the worksheet, you can
rightclick on it and choose Assign Macro.

Remember that this is the button from the Forms toolbar--not the commandbutton
from the Control toolbox toolbar.

mceder1 wrote:

Dave
I created a button and copied your code from below. I guess that I dont
know how to put the button on the workbook.
--
Matt

"Dave Peterson" wrote:

I'd create a dedicated macro and then put a button from the Forms toolbar onto
that sheet and assign the macro to this button.

Option Explicit
sub PrintMe()
with activesheet
if isnumeric(.range("I3").value) then
.range("I3").value = .range("I3").value + 1
.printout preview:=true
else
Beep
msgbox "I3 isn't a number!"
end if
end with
end sub

mceder1 wrote:

I would like to have excel auto number a new work sheet every time I print a
new sheet. The form that I have created has the page numbers in cell I3 and
only has to number from 7 to infinity.
--
Matt

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How do you create a macro to auto number in excel 2003

Time to share what you pasted into that code module.

And to indicate what line caused the error.

And just a reminder, the original code had Preview:=true to save some trees.
You'll want to change this when you're done testing.

mceder1 wrote:

Dave
got the button to work. Now I get an error that states Compile error:
expected : end of statement. What is this?
--
Matt

"Dave Peterson" wrote:

Delete that button (I think you used the wrong one)

Then View|Toolbars|show the Forms toolbar
And use the button from that toolbar.



mceder1 wrote:

-- I donot get a assign macro command. I may not be getting to the right
forms command. I am new to macros if you couldnt tell
Matt

"Dave Peterson" wrote:

Put the code in a general module--not behind the worksheet and not behind the
ThisWorkbook module.

Then show the Forms toolbar.
Plop a button from that toolbar onto the worksheet.

You'll be prompted to assign the macro--choose this macro.

If you have a button from the Forms toolbar already on the worksheet, you can
rightclick on it and choose Assign Macro.

Remember that this is the button from the Forms toolbar--not the commandbutton
from the Control toolbox toolbar.

mceder1 wrote:

Dave
I created a button and copied your code from below. I guess that I dont
know how to put the button on the workbook.
--
Matt

"Dave Peterson" wrote:

I'd create a dedicated macro and then put a button from the Forms toolbar onto
that sheet and assign the macro to this button.

Option Explicit
sub PrintMe()
with activesheet
if isnumeric(.range("I3").value) then
.range("I3").value = .range("I3").value + 1
.printout preview:=true
else
Beep
msgbox "I3 isn't a number!"
end if
end with
end sub

mceder1 wrote:

I would like to have excel auto number a new work sheet every time I print a
new sheet. The form that I have created has the page numbers in cell I3 and
only has to number from 7 to infinity.
--
Matt

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How do you create a macro to auto number in excel 2003

This is what i put in for the code

Sub BOption Explicit
Sub PrintMe()
With ActiveSheet
If IsNumeric(.Range("I3").Value) Then
.Range("I3").Value = .Range("I3").Value + 1
.PrintOut preview:=True
Else
Beep
MsgBox "I3 isn't a number!"
End If
End With
End Sub
utton1_Click()

End Sub

Then for the preview what do I need to change it to.


--
Matt


"Dave Peterson" wrote:

Time to share what you pasted into that code module.

And to indicate what line caused the error.

And just a reminder, the original code had Preview:=true to save some trees.
You'll want to change this when you're done testing.

mceder1 wrote:

Dave
got the button to work. Now I get an error that states Compile error:
expected : end of statement. What is this?
--
Matt

"Dave Peterson" wrote:

Delete that button (I think you used the wrong one)

Then View|Toolbars|show the Forms toolbar
And use the button from that toolbar.



mceder1 wrote:

-- I donot get a assign macro command. I may not be getting to the right
forms command. I am new to macros if you couldnt tell
Matt

"Dave Peterson" wrote:

Put the code in a general module--not behind the worksheet and not behind the
ThisWorkbook module.

Then show the Forms toolbar.
Plop a button from that toolbar onto the worksheet.

You'll be prompted to assign the macro--choose this macro.

If you have a button from the Forms toolbar already on the worksheet, you can
rightclick on it and choose Assign Macro.

Remember that this is the button from the Forms toolbar--not the commandbutton
from the Control toolbox toolbar.

mceder1 wrote:

Dave
I created a button and copied your code from below. I guess that I dont
know how to put the button on the workbook.
--
Matt

"Dave Peterson" wrote:

I'd create a dedicated macro and then put a button from the Forms toolbar onto
that sheet and assign the macro to this button.

Option Explicit
sub PrintMe()
with activesheet
if isnumeric(.range("I3").value) then
.range("I3").value = .range("I3").value + 1
.printout preview:=true
else
Beep
msgbox "I3 isn't a number!"
end if
end with
end sub

mceder1 wrote:

I would like to have excel auto number a new work sheet every time I print a
new sheet. The form that I have created has the page numbers in cell I3 and
only has to number from 7 to infinity.
--
Matt

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How do you create a macro to auto number in excel 2003

You copied the code that you put behind the worksheet to the General module and
you copied stuff that wasn't needed. Try copying and pasting the original code.


mceder1 wrote:

This is what i put in for the code

Sub BOption Explicit
Sub PrintMe()
With ActiveSheet
If IsNumeric(.Range("I3").Value) Then
.Range("I3").Value = .Range("I3").Value + 1
.PrintOut preview:=True
Else
Beep
MsgBox "I3 isn't a number!"
End If
End With
End Sub
utton1_Click()

End Sub

Then for the preview what do I need to change it to.

--
Matt

"Dave Peterson" wrote:

Time to share what you pasted into that code module.

And to indicate what line caused the error.

And just a reminder, the original code had Preview:=true to save some trees.
You'll want to change this when you're done testing.

mceder1 wrote:

Dave
got the button to work. Now I get an error that states Compile error:
expected : end of statement. What is this?
--
Matt

"Dave Peterson" wrote:

Delete that button (I think you used the wrong one)

Then View|Toolbars|show the Forms toolbar
And use the button from that toolbar.



mceder1 wrote:

-- I donot get a assign macro command. I may not be getting to the right
forms command. I am new to macros if you couldnt tell
Matt

"Dave Peterson" wrote:

Put the code in a general module--not behind the worksheet and not behind the
ThisWorkbook module.

Then show the Forms toolbar.
Plop a button from that toolbar onto the worksheet.

You'll be prompted to assign the macro--choose this macro.

If you have a button from the Forms toolbar already on the worksheet, you can
rightclick on it and choose Assign Macro.

Remember that this is the button from the Forms toolbar--not the commandbutton
from the Control toolbox toolbar.

mceder1 wrote:

Dave
I created a button and copied your code from below. I guess that I dont
know how to put the button on the workbook.
--
Matt

"Dave Peterson" wrote:

I'd create a dedicated macro and then put a button from the Forms toolbar onto
that sheet and assign the macro to this button.

Option Explicit
sub PrintMe()
with activesheet
if isnumeric(.range("I3").value) then
.range("I3").value = .range("I3").value + 1
.printout preview:=true
else
Beep
msgbox "I3 isn't a number!"
end if
end with
end sub

mceder1 wrote:

I would like to have excel auto number a new work sheet every time I print a
new sheet. The form that I have created has the page numbers in cell I3 and
only has to number from 7 to infinity.
--
Matt

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How do you create a macro to auto number in excel 2003

You can use the Visual Basic toolbox and drag drop a button onto the
form.

with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com

*** Sent via Developersdex http://www.developersdex.com ***
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
Auto adding a macro when Excel 2003 opens gigabyteconsulting Excel Discussion (Misc queries) 4 July 6th 09 08:57 PM
Allow Auto Filter Within Macro in Excel 2003 (SP2) Pank New Users to Excel 2 May 14th 07 08:48 AM
Trying to create a macro to auto number blank (excel 2003) mceder1 Excel Programming 1 April 18th 07 09:59 AM
Create formula which will number a list in Excel 2003 Wessel Excel Discussion (Misc queries) 3 October 26th 06 10:29 AM
VBA Excel Macro - One File Auto Create Multiple Excel Worksheets! jsamples25 Excel Programming 0 June 22nd 05 11:16 PM


All times are GMT +1. The time now is 05:59 PM.

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

About Us

"It's about Microsoft Excel"