+ Reply to Thread
Results 1 to 3 of 3

Need macro to consolidate a list of products one by one into a macro enabled excel sheet

  1. #1
    Registered User
    Join Date
    03-22-2013
    Location
    leuven
    MS-Off Ver
    Excel 2010
    Posts
    13

    Need macro to consolidate a list of products one by one into a macro enabled excel sheet

    Hi guys,

    I really hope you can help me with this one:

    I have workfile : example 11 (macro enabled).
    In the 'welkom' sheet the data of a student gets extracted out of a masterfile (which in this file is in sheet2), this happens with a large function which I didn't copy here the extraction is based on the name in cell B1.

    I have a seperate list of students (a class) in file : example 2.

    Would it be possible to help me out with a macro allowing me to : select the first student in the example 2 file, put it in cell B1 of example11 (sheet Welkom), run the macro behind the button (save button, this macro is copied under the button) and jump to the next student in file example 2 doing the same..?

    I know this means i will probably overwrite my additional data list in B1, but I will just copy the file..

    This has to happen for 500 students..

    Looking forwards to your response

    Kind regards,
    Thomas
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    03-22-2013
    Location
    leuven
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Need macro to consolidate a list of products one by one into a macro enabled excel she

    What I have now (with cell 1,3 holding a counta function in excel):

    Sub studentsbulk()
    Max = Cells(1, 3).Value
    For i = 1 To Max
    Worksheets("Welkom").Cells("B2").Value = Worksheets("sheet1").Cells(i, 1).Value

    'save macro
    Range("B5:D10").Select
    ChDir "C:\Desktop"
    Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    "C:\johangedrag.pdf", Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
    False
    Next i

    End Sub

    I'm a total newb with vba so I'm not sure if this is somewhat decent

    Thanks guys
    Last edited by gehawk; 04-10-2013 at 04:52 AM.

  3. #3
    Registered User
    Join Date
    03-22-2013
    Location
    leuven
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Need macro to consolidate a list of products one by one into a macro enabled excel she

    Ok, more decent approach, based on findings on google of a guy named Jerry

    Trying to start out with copying cell 1 of example 2 (datasheet) towards example 11 (mastersheet)

    'original version from Jerry Beaucaire'

    Sub CopyToMaster2()
    'macro goes IN the master workbook,original version from Jerry Beaucaire'

    Dim wsMaster As Worksheet, wbDATA As Workbook
    Dim NextRow As Long, LastRow As Long

    Set wsMaster = ThisWorkbook.Sheets("Welkom")
    Set wbDATA = Workbooks.Open("C:\example2.xlsx)

    With wbDATA.Sheets("sheet1")
    If LastRow > 0 Then
    .Range("A1").Copy
    wsMaster.Range("B1" ).PasteSpecial xlPasteValues
    wsMaster.Range("B1" ).PasteSpecial xlPasteFormats
    End If
    End With

    wbDATA.Close False
    End Sub

    Not working yet though, Now i need to implement a way to switch to the next value in example 2 (datasheet), and repeat the copy. Leaving out the save for now

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1