Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Is this code correct?

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Posts
    220
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,
    I was just wondering if all the code below is correct.I was trying to add the find option to it and it leaves funny black cells behind. Never seen this before happening. It seems to copy correctly though.


    Thanks a million
    Anndonny


    Dim rng As Range
    Dim rng_find As Range
    Set rng_find = Workbooks("Test1.xls").Worksheets("Sheet1").Range("A1:A65000").Find(what:="RedLine")
    With Workbooks("Test2.xls").Worksheets("Sheet1")
    ' periods in front of all references except rng
    Set rng = .Range(.Range("A2"), .Range("G2").End(xlDown))
    End With
    rng.Copy Destination:=rng_find.Offset(1, 0)


  2. #2
    New Member
    Join Date
    Apr 2002
    Posts
    41
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Andonny

    I don't know what you mean by leaves funny black cells behind, but the code seems to work. If, somewhere in your original code, you are selecting before copying or pasting, the black cells could just be the selected cells.

    If that is not the case, you may like to post the full code.

    Any help?

    Regards

    Robb__

Some videos you may like

User Tag List

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
  •