Macro or other automated method to update and print a worksheet

Chuck6475

Board Regular
Joined
Sep 30, 2012
Messages
126
I developed a spreadsheet to score golf tournaments, do skins, various flights, etc. to help the Men's Club. It has been fun but an Excel expert, I'm not. If I could solve the problem below without using a macro that would be preferred.

Once upon a time I was a programmer, but that's moons ago. I've never written any VB or Macros for Excel. I'm using 2003 on W7 but the club uses 2007 on XP, I think.

My issue is using Excel to print the scorecards. I've developed a worksheet to print scorecards by group number. As a group number changes so does a great deal of the data on the scorecard to be printed.

I'm looking for a method to not have to manual change the group number and print the scoresheet.

I found a macro written by Jbeaucaire in May 2010 on this site that looked promising but I don't understand the code well enough to know how to modify it to work. Here is that code:
Option Explicit

Sub IterateValues()
Dim CpyRNG As Range, MyVal As Range
Application.ScreenUpdating = False

Set CpyRNG = Sheets("Data").Range("A:A").SpecialCells(xlCellTypeConstants)

For Each MyVal In CpyRNG
With Sheets("Form")
.Range("A1").Value = MyVal.Value
.Calculate
.PrintOut Copies:=1
End With
Next MyVal

Set CpyRNG = Nothing
Application.ScreenUpdating = True
End Sub

The Group number is sequential from 1 to some tournament max. The printed material is the same on each card but the data changes depending upon the group number.

Thanks in advance for your help.
 
Code:
    [COLOR=darkblue]With[/COLOR] wsPrint
        [COLOR=#ff0000].Visible = xlSheetVisible[/COLOR]
        [COLOR=darkblue]For[/COLOR] Group = 1 [COLOR=darkblue]To[/COLOR] Sheets("Tee_Times").Range("A1").Value
            .Range("W1").Value = Group
            .Calculate
            .PrintOut Copies:=1
        [COLOR=darkblue]Next[/COLOR] Group
        [COLOR=#ff0000].Visible = xlSheetHidden[/COLOR]
    [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]With[/COLOR]
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
All this interesting stuff just makes me think of new features. Given the .visible seems to work on the "active" worksheet. Can the same be done to "non-active" worksheets.

This program has like 35 worksheets, many of which are not applicable for current tournaments. Therefore I would like to hide or unhide worksheets depending upon the format of the tournament. Is that as easy as this was?
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,123
Members
452,381
Latest member
Nova88

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