Page 7 of 7 FirstFirst ... 567
Results 61 to 63 of 63

Thread: copying cells from sheet 1 to various other sheets

  1. #61
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,199
    Post Thanks / Like
    Mentioned
    470 Post(s)
    Tagged
    47 Thread(s)

    Default Re: copying cells from sheet 1 to various other sheets

    It's the parts in red here
    Code:
             If Not Evaluate("isref('" & Left(Ky, 30) & "'!A1)") Then
                Sheets.Add(, Sheets(1)).Name = Left(Ky, 30)
                Ws.Range("A1:A" & UsdRws).SpecialCells(xlVisible).EntireRow.Copy Sheets(Left(Ky, 30)).Range("A1")
                Ws.Range("M5:M" & UsdRws).SpecialCells(xlVisible).Value = Date
             Else
                On Error Resume Next
                Ws.Range("A5:A" & UsdRws).SpecialCells(xlVisible).EntireRow.Copy Sheets(Left(Ky, 30)).Range("D" & Rows.Count).End(xlUp).Offset(1, -3)
    You can happily change the 30 to another number, as long as it's no greater than 31, but be careful about making it too small.
    Otherwise you could end up with company names like "Cannon" and "Cannon UK" being on the same sheet.
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  2. #62
    Board Regular
    Join Date
    Aug 2019
    Posts
    80
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: copying cells from sheet 1 to various other sheets

    Are you saying that bit of code will work in any macro?

  3. #63
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,199
    Post Thanks / Like
    Mentioned
    470 Post(s)
    Tagged
    47 Thread(s)

    Default Re: copying cells from sheet 1 to various other sheets

    No.
    You can use the left function in VBA exactly the same way as in Xl, it just depends on what value you want it to operate on & where that value is.
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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