1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Data Validation with VBA

Discussion in 'Business Applications' started by itisalikhan, Feb 8, 2013.

Thread Status:
Not open for further replies.
Advertisement
  1. itisalikhan

    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.
     

    Attached Files:

  2. 20_2_Many

    20_2_Many

    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?, ??)
     
  3. 20_2_Many

    20_2_Many

    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
     
  4. itisalikhan

    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.
     
  5. itisalikhan

    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
     

    Attached Files:

  6. dvk01

    dvk01 Moderator Malware Specialist

    Joined:
    Dec 14, 2002
    Messages:
    56,236
    First Name:
    Derek
    I have merged both threads together as they appear to be connected. Please remain in this topic until completely solved to your satisfaction
     
  7. Sponsor

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 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1088655

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice