+ Reply to Thread
Results 1 to 3 of 3

If statement issue

  1. #1
    Forum Contributor
    Join Date
    10-28-2003
    Location
    Happyville, USA
    MS-Off Ver
    365
    Posts
    294

    If statement issue

    I need to tweak the code I have below:

    PHP Code: 
                If Range("P2").Value <> "" Then
    Range
    ("P2").Select
    Range
    (SelectionSelection.End(xlDown)).Select
    Selection
    .Copy
    Range
    ("O2").Select
        Selection
    .PasteSpecial Paste:=xlPasteValuesOperation:=xlNoneSkipBlanks _
            
    :=FalseTranspose:=False
    End 
    If 
    That code works great. But I ran into a problem. If there is data in P2 but all other cells in that column are blank it is copying down to the bottom of the sheet and then pasting blank cells over the data in column O.

    I want to code to not copy past P2 if there is no other data under P2.

    Thank in advance for you help.

    Eddie.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606
    Try working from the bottom up, and you don't need the Select statement.
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    10-28-2003
    Location
    Happyville, USA
    MS-Off Ver
    365
    Posts
    294
    Wow, that worked great. It is more fundamentally sound than what I was doing.

    Thank you so very much.

    Eddie.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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