Results 1 to 1 of 1

Importing Specific Cells into another Workbook

Threaded View

  1. #1
    Registered User
    Join Date
    12-16-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    1

    Importing Specific Cells into another Workbook

    Hi from Montreal Canada
    I'm a complete newb to vba
    I need to transfer certain cells from 1Quotation Eng 2013 New macro (Worksheet) to Sales 2013 Test (sheet 1)
    Quotation/Sales
    C1>D1
    C2>E1
    C3>F1
    B4>C1
    I2>G1
    --------------------------------------------------------------------------------------------------
    Sub BulkImport()
    Dim InFileNames As Variant
    Dim OutFileName As String
    Dim fCtr As Long
    Dim tempWks As Worksheet
    Dim consWks As Worksheet
    Dim destCell As Range
    Dim myRow As Long
    Dim total As Long
    Dim LastRow As Long
    Set consWks = ActiveWorkbook.Sheets(1)
    LastRow = consWks.Range("A65536").End(xlUp).Row
    InFileNames = Application.GetOpenFilename _
    (FileFilter:="Excel Files, *.xlsx", MultiSelect:=True)
    Application.ScreenUpdating = False
    If IsArray(InFileNames) Then
    For fCtr = LBound(InFileNames) To UBound(InFileNames)
    Set tempWkbk = Workbooks.Open(Filename:=InFileNames(fCtr))
    consWks.Range("D" & fCtr + LastRow).Value = tempWkbk.Worksheets(2).Range("C1").Value
    consWks.Range("E" & fCtr + LastRow).Value = tempWkbk.Worksheets(2).Range("C2").Value
    consWks.Range("F" & fCtr + LastRow).Value = tempWkbk.Worksheets(2).Range("C3").Value
    consWks.Range("C" & fCtr + LastRow).Value = tempWkbk.Worksheets(2).Range("B4").Value
    consWks.Range("G" & fCtr + LastRow).Value = tempWkbk.Worksheets(2).Range("I2").Value
    consWks.Range("S" & fCtr + LastRow).Value = tempWkbk.Name
    ActiveWorkbook.Close
    Next fCtr
    Else
    MsgBox "No file selected"
    End If
    With Application
    .StatusBar = False
    .ScreenUpdating = True
    End With
    End Sub
    I was hoping someone can help me out.
    Thanks in advance


    Moderator's Note: Welcome to the forum, btw when posting codes the codes should be wrapped with code tags. Select the code then hit the "#" symbol. I'll do it for now. Thank for joining.
    Last edited by lakeroof; 02-07-2013 at 11:26 AM.

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