Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Macro Printing

Hello,
I would like to print several reports with a click of a macro. What I
currently have is a drop down box where I make my selection then I click on a
macro which hide/unhide columns based on my drop down selection.

Is there a macro that I can setup where for every drop down selection there
is, run it then print it? I currently do that 14 times, it would be nice to
avoid that.

Thanks,
MrRJ

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Macro Printing

It's a little hard to answer that question directly for you as you didn't
show us what is in the drop down box nor the code that executes your
selections. Generally, you should be able to wrap your current macros code
with a For Each loop in which your In object would be an Array function call
with your 14 options listed as its arguments. For example, if your drop down
box items were "Report1", "Report2", "Report3" and so on, then you should be
able to do something like this in your macro...

Dim V As Variant
'
' Other Dim statements here
'
For Each V In Array("Report1", "Report2", "Report3"...etc)
'
' Your existing macro code goes here although however you
' pass the drop down item text to the code, you would now
' use the V variable in its place
'
Next

--
Rick (MVP - Excel)


"MrRJ" wrote in message
...
Hello,
I would like to print several reports with a click of a macro. What I
currently have is a drop down box where I make my selection then I click
on a
macro which hide/unhide columns based on my drop down selection.

Is there a macro that I can setup where for every drop down selection
there
is, run it then print it? I currently do that 14 times, it would be nice
to
avoid that.

Thanks,
MrRJ


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Macro Printing

Hi Rick, sorry for not responding sooner. I had left for the day when you
responded. Here is my code that I use. This code is used after I make my
drop down selection. Not sure what you mean by "however you pass the drop
down item text to the code"?
Hope this helps you.

Private Sub CommandButton12_Click()
Range("A:HB").EntireColumn.Hidden = False

For Each c In Range("C1:HI1")
If c < 1 Then Columns(c.Column).Hidden = True
Next c

Range("B10").Select
End Sub

"Rick Rothstein" wrote:

It's a little hard to answer that question directly for you as you didn't
show us what is in the drop down box nor the code that executes your
selections. Generally, you should be able to wrap your current macros code
with a For Each loop in which your In object would be an Array function call
with your 14 options listed as its arguments. For example, if your drop down
box items were "Report1", "Report2", "Report3" and so on, then you should be
able to do something like this in your macro...

Dim V As Variant
'
' Other Dim statements here
'
For Each V In Array("Report1", "Report2", "Report3"...etc)
'
' Your existing macro code goes here although however you
' pass the drop down item text to the code, you would now
' use the V variable in its place
'
Next

--
Rick (MVP - Excel)


"MrRJ" wrote in message
...
Hello,
I would like to print several reports with a click of a macro. What I
currently have is a drop down box where I make my selection then I click
on a
macro which hide/unhide columns based on my drop down selection.

Is there a macro that I can setup where for every drop down selection
there
is, run it then print it? I currently do that 14 times, it would be nice
to
avoid that.

Thanks,
MrRJ



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Macro Printing

Rick,
Are you available?

"Rick Rothstein" wrote:

It's a little hard to answer that question directly for you as you didn't
show us what is in the drop down box nor the code that executes your
selections. Generally, you should be able to wrap your current macros code
with a For Each loop in which your In object would be an Array function call
with your 14 options listed as its arguments. For example, if your drop down
box items were "Report1", "Report2", "Report3" and so on, then you should be
able to do something like this in your macro...

Dim V As Variant
'
' Other Dim statements here
'
For Each V In Array("Report1", "Report2", "Report3"...etc)
'
' Your existing macro code goes here although however you
' pass the drop down item text to the code, you would now
' use the V variable in its place
'
Next

--
Rick (MVP - Excel)


"MrRJ" wrote in message
...
Hello,
I would like to print several reports with a click of a macro. What I
currently have is a drop down box where I make my selection then I click
on a
macro which hide/unhide columns based on my drop down selection.

Is there a macro that I can setup where for every drop down selection
there
is, run it then print it? I currently do that 14 times, it would be nice
to
avoid that.

Thanks,
MrRJ



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
Macro Printing MrRJ Excel Discussion (Misc queries) 5 March 31st 09 04:41 PM
printing macro? James Cornthwaite Excel Programming 1 November 3rd 06 12:44 AM
Macro for printing Ewout Excel Worksheet Functions 1 September 23rd 06 11:33 PM
Printing Macro? th3p3st Excel Programming 1 September 29th 05 05:22 PM
Printing Macro kwedde01 Excel Worksheet Functions 0 June 9th 05 11:05 PM


All times are GMT +1. The time now is 01:56 AM.

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"