Results 1 to 9 of 9

Copying to first empty row?

Threaded View

  1. #1
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    548

    Copying to first empty row?

    I finally have the copying aspects of my macro working, after much help here thanks. To discuss the next stage I've attached a much simplified version of both source and destination workbooks used.

    The macro currently copies data from Source-Simplified.xlsm to fixed row 8 of WalkIndex-Extract.xlsm
    Sub Extract_Simplest()
    
    Dim wi As Workbook
    Set wi = Workbooks("WalkIndex-Extract.xlsm")
    
    Dim wb As Workbook
    Set wb = Workbooks("Source-Simplified.xlsm")
    
    'Track name
    wb.Worksheets("Track Data").Range("B5").Copy _
    Workbooks("WalkIndex-Extract.xlsm").Sheets("Target").Range("C8")
      
    'Main FW Heading (C6 & B3 in formula)
    wb.Worksheets("Track Data").Range("B27").Copy
    wi.Sheets("Target").Range("D8").PasteSpecial Paste:=xlPasteValues
    
    End Sub
    I want to edit that to copy instead to the first row in which col A is empty, row 4 in my example. The first run would therefore enter two cells into row 4, instead of row 8. And so on, as the number of rows increases.

    This code finds the first empty row OK.

    Sub FirstEmptyRowA1()
    'Find the first empty row in Column A
    Dim lngLastRow As Long
    lngLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    
    Dim FirstEmpty As Long
    FirstEmpty = lngLastRow + 1
    
    MsgBox (FirstEmpty)
    
    End Sub
    But attempts to use 'FirstEmpty' in Sub Extract_Simplest() have so far defeated me and any help would be appreciated please
    Attached Files Attached Files
    Terry, East Grinstead, UK
    Excel 365, Win 10 Pro, i7 PC, 4.0 GHz

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Copying values into empty cells below
    By kban in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-08-2017, 12:06 PM
  2. Copying into empty cells
    By butlerar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-28-2014, 09:29 PM
  3. [SOLVED] Copying to next empty row
    By 4evra in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2013, 07:17 PM
  4. Copying to Next Empty Row
    By Pasha81 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-10-2009, 01:27 PM
  5. Copying a value to the next empty cell
    By Arney in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-11-2009, 12:57 PM
  6. copying a range to first empty row is copying over data
    By jseufert in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-13-2009, 03:45 AM
  7. copying empty cells as empty
    By sjhonny in forum Excel General
    Replies: 2
    Last Post: 01-17-2007, 06:52 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