Let macro prompt for test string and input this into a cell

Chaka

New Member
Joined
Mar 3, 2011
Messages
2
Hi All

I hope the subject is not to misleading as I'm new to Excel/VBA and not sure how to describe it in a short sentence. Please let me know if I need to add additional info or change the format.

The background:

Using office 2010, Win 7

Workbook contains 2 sheets called 'Blue' which is a score sheet for printing and 'Entrants' which is the db containing all the details of participants.

I have a print macro (can't recall where I got it) that populates the score sheet with a participants info and loops through the database.

Behind the 'Entrants' sheet I have the following

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

'Range numbers to be confirmed!!!

If Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub
Worksheets("Blue").Range("C8").Formula = "Blue Range - 26 March 2011" 'Range/Date to change as required
Worksheets("Blue").Range("E13").Formula = Target.Offset(0, 1) & " " & Target.Offset(0, 2)   'Name & Surname
Worksheets("Blue").Range("E15").Formula = Target.Offset(0, 6)
Worksheets("Blue").Range("E17").Formula = Target.Offset(0, 3)       
Worksheets("Blue").Range("E19").Formula = Target.Offset(0, 4)      
Worksheets("Blue").Range("E21").Formula = Target.Offset(0, 5) 
Worksheets("Blue").Range("C2").Formula = Target.Offset(0, 11)
Worksheets("Blue").Range("C5").Formula = Target.Offset(0, 10)

End Sub

The module
Code:
Sub PrintAllCards()

    Sheets("Entrants").Select
    Range("A2").Select
        
 Do Until Selection = ""
    Sheets("Blue").PrintOut
    Selection.Offset(1, 0).Select
 Loop
    
End Sub

What I would like to do:
I want to print three different score sheets. The only thing to change is cell C8 with a different name and date (but same list of entrants).

- How can I do this by letting the macro prompt me for the correct value and printing the set and correct value in C8?

- Or is there another way?

Unfortunately the only way I can do it at the moment is to create another workbook, edit the cell C8 value and update the rest of the code with the correct sheet names if needed.

Thanks for your time and patience
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Re: Let macro prompt for text string and input this into a cell

Noticed my subject said test instead of text. Not sure how to edit the original thread heading.

Don't know if this confused the issue.
Please let me know a look at the actual xlsx file is needed.
 
Upvote 0

Forum statistics

Threads
1,224,526
Messages
6,179,322
Members
452,906
Latest member
Belthazar

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