Data Validation with VBA

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

itisalikhan

Thread Starter
Joined
Oct 26, 2012
Messages
6
Hi there!
On sheet B, cell C7, I have a dropdown list (using data validation) of names. The things I want to do with vb codes are as under:-
Let suppose, I select the first name from drop and took the print of page1. Now I want to automatically
Select the next name (i.e Mike) from dropdown list and take the print of page1. Then
Select the next name (i.e Steve) from dropdown list and take the print of page1. Then
Select the next name (i.e Jhon) from dropdown list and take the print of page1.
And so on till last name (i.e Blair).

Please note that I have some blank fields in my dropdown list. I just want to ignore them, mean I did not want to take the print for those blank fields. (sample file is attached)
Any help would be highly appreciated.
 

Attachments

Joined
Jun 29, 2012
Messages
518
This macro should print sheet B for each name in the list, ignoring blanks.
It can be modified to start anywhere in the list, but I am unclear as to the parameters. Also unclear exactly what 'take the print of page 1' means (i.e. actually print it? Screen shot it?, ??)
 
Joined
Jun 29, 2012
Messages
518
Sub namelist()
Sheets("A").Select
lastrowd = Range("D" & Rows.Count).End(xlUp).Row
For I = 3 To lastrowd
Range("D" & I).Select
thisname = ActiveCell
If Len(thisname) > 0 Then
Sheets("B").Select
Range("C7") = thisname
ActiveSheet.PrintOut Copies:=1, Collate:=True
End If

Sheets("A").Select
Next I
 

itisalikhan

Thread Starter
Joined
Oct 26, 2012
Messages
6
Sorry for late reply, actully my grandmother passed away. Therefore i can not spare the time.
Actually on sheet B, i have a salary voucher. Name is mentioned in Cell C7. As there is a dropdown list in the cell C7. I just change the name by clicking the dropdown list and take the print for page number one.
Sheet B have three pages, i just want to take the print of page number one. I just want a macro which automatically select the naxt name from dropdown list and take the print of first page of sheet B. Hope i make it clear. Sorry for my bad english as i am not native speaker.
 

itisalikhan

Thread Starter
Joined
Oct 26, 2012
Messages
6
Hi there!
On sheet A, I have data in four column i.e Sr. NO, Names, Desigantion, Amount.
On sheet B, I have a pre-designed payment voucher. In cell C7 of sheet B, I have a dropdown list (using data validation) that show all the names mentioned in second column (Names) of Sheet A. I am using index and match function with reference to cell C7. As I change the name from dropdown list (exist in cell C7), the other details like Designation and Amount etc automatically updates. Everything is working fine.
The problem begins when I want to take the print for all employees. Every time, I have to manually click the dropdown list and select the name and then I gives the print command. I am seeking for codes that automatically select the next name from dropdown list and take the print of payment voucher for me.
I am attaching the sample file. Please see the comments on the cell highlighted with green. Hope the file will make it more clear.
Any help would be highly appreciated
 

Attachments

dvk01

Derek
Retired Moderator Retired Malware Specialist
Joined
Dec 14, 2002
Messages
56,452
I have merged both threads together as they appear to be connected. Please remain in this topic until completely solved to your satisfaction
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top