Results 1 to 7 of 7

Copy info from 1 sheet to another if data is in cell A, if not then use cell B

Threaded View

  1. #1
    Registered User
    Join Date
    07-05-2015
    Location
    Sydney
    MS-Off Ver
    14.0.6023.1000
    Posts
    4

    Copy info from 1 sheet to another if data is in cell A, if not then use cell B

    I'm completely new to VBA, so I hope this makes sense! I have a master page with all my data on it called "client list". I want to extract data from this master list and move it to other sheets. I want to run a macro that says "if a line of data has Sally's name under the 'allocation' column (column M), and there is no 'discharge date' (column V), then copy to the sheet called Sally, but if there's no name in the 'allocation' column, then use the data in the 'assessment' column (column H), and if the name in the assessment column in 'sally', then copy to the sheet called Sally". Hope this makes sense!!!! So far I have the below, but it's not working



    Dim i, LastRow
    LastRow = Sheets("client list").Range("A" & Rows.Count).End(xlUp).Row
    Sheets("Sally").Range("A2:Z1000").Clear
    For i = 2 To LastRow
    If Sheets("client list").Cells(i, "M").Value = "Sally" And Sheets("client list").Cells(i, "V").Value = "" Then
    Sheets("client list").Cells(i, "M").EntireRow.Copy Destination:=Sheets("Sally").Range("A" & Rows.Count).End(xlUp).Offset(1)
    Next i
    For i = 2 To LastRow
    Else
    If Sheets("client list").Cells(i, "M" And "V").Value = "" And Sheets("client list").Cells(i, "H").Value = "Sally" Then
    Sheets("client list").Cells(i, "M").EntireRow.Copy Destination:=Sheets("Sally").Range("A" & Rows.Count).End(xlUp).Offset(1)
    End If
    Next i
    Last edited by theparlourroom; 07-05-2015 at 05:44 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Copy formula in sheet to all rows containing info in Cell A
    By Elmarie_Potgieter in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-16-2015, 05:43 AM
  2. Replies: 4
    Last Post: 09-18-2014, 09:07 PM
  3. [SOLVED] Copy cell from 1 sheet to another sheet depending on what info is displayed in a cell
    By chilli76 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-24-2013, 12:33 PM
  4. [SOLVED] Need to Copy cell info from one sheet to rows on a new sheet.
    By gavdean17 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-13-2012, 03:07 PM
  5. [SOLVED] Copy row(s) to another sheet using date and cell info
    By Sigge in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-14-2012, 03:01 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