+ Reply to Thread
Results 1 to 3 of 3

Macro to copy specific cells from diff worksheet

  1. #1
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2003
    Posts
    31

    Macro to copy specific cells from diff worksheet

    Hi,

    I was able to get help from another member on this issue. I just realized that I need to expand on this macro. Currently, this macro is copying a range from a different worksheet until it reaches an empty cell. The destination of this range is coming to a sheet named Journal Input. Alongside this, the macro is bringing a specific cell "C8" from that different worksheet and copying and filling down depending on what the range has brought over. This macro is also bringing values from a range of C23 and copying until it hits an empty cell.What I need is for this macro to also bring C10, C11,C12, C13, C14. I will also attach a file explaining more.

    Sub PullData()

    Dim ws As Worksheet: Set ws = Sheets("Journal Input")
    Dim wksht As Worksheet
    Dim lMasterLR As Long, lwkshtLR1 As Long, lwkshtLR2 As Long
    Dim strAccount As String

    On Error GoTo ErrHandler

    Application.ScreenUpdating = False

    For Each wksht In Worksheets
    If wksht.Name <> "Journal Input" Then
    lMasterLR = ws.Range("A" & Rows.Count).End(xlUp).Row
    strAccount = wksht.Range("C8").Value
    If wksht.Range("B23").Value <> "" Then
    lwkshtLR1 = wksht.Range("B" & Rows.Count).End(xlUp).Row
    wksht.Range("B23:B" & lwkshtLR1).Copy
    ws.Range("A" & lMasterLR).Offset(1, 0).PasteSpecial xlPasteValues
    ws.Range("B" & lMasterLR + 1).Value = strAccount
    ws.Range("B" & lMasterLR + 1, "C" & ws.Range("A" & Rows.Count).End(xlUp).Row).FillDown
    End If
    If wksht.Range("C23").Value <> "" Then
    lwkshtLR2 = wksht.Range("C" & Rows.Count).End(xlUp).Row
    wksht.Range("C23:C" & lwkshtLR2).Copy
    ws.Range("H" & lMasterLR).Offset(1, 0).PasteSpecial xlPasteValues
    End If
    End If
    Next wksht

    Application.ScreenUpdating = True

    Debug.Print "Procedure Completed Successfully"

    ErrHandler:
    Debug.Print "There has been a critical error."
    Application.ScreenUpdating = True
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Macro to copy specific cells from diff worksheet

    Give this a try:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Macro to copy specific cells from diff worksheet

    THANK YOU! it worked!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro to copy specific data from one WB to specific cells in another WB based on specific
    By d_rose in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-26-2014, 11:05 AM
  2. Replies: 3
    Last Post: 06-17-2013, 06:00 AM
  3. Replies: 2
    Last Post: 01-13-2013, 06:50 AM
  4. HELP! Macro to Copy specific cells from one sheet to another based on specific criteria
    By atriscritti in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-11-2012, 11:05 AM
  5. Non-Sheet Specific Macro to copy range of cells to next worksheet in WB
    By Petrolcb41 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-29-2010, 11:04 AM

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