+ Reply to Thread
Results 1 to 7 of 7

Macro question

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

    Macro question

    Hi,

    I'm building a macro that performs many tasks. One of the functions will place a number in column I depending on what is in column H. It will then cut the value out of column I and paste it on top of value H.

    The problem is that a situation may come up where there is no value to be changed. Column H would be correct and no value would place in column I. There would be nothing in column I to cut and paste into column H.

    How do I get it to cut the data out of column I and place it column H only if there is something in column I?

    I hope I have I explained myself correctly. Let me know if there is anything I can do make it more clear.

    Eddie.

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    By starting your macro with a test (IF) on column I which will then trigger your two possibilities ...

    HTH
    Carim

  3. #3
    Forum Contributor
    Join Date
    10-28-2003
    Location
    Happyville, USA
    MS-Off Ver
    365
    Posts
    300
    Thank you so much for your quick reply.

    I have been trying various forms of "if" to get it to work but I can't seem to gtet it right. Below is the VBA text that cuts data out of the column I and pastes it into column H. How does this data have to read so it will only cut something out of column I if there is a value in it (not blank)?

    Range("I2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Cut
    Range("G2").Select
    ActiveSheet.Paste

    Any thoughts are most welcome.

    Eddie

  4. #4
    Forum Contributor starryknight64's Avatar
    Join Date
    09-27-2006
    Location
    Missouri
    MS-Off Ver
    2003 (Work) & 2007 (Home)
    Posts
    193
    In the column that you want pasted into, try this:

    =if(A1<>"",A1,)

    Where A1 is the column you are cutting from...

    HTH
    starryknight64

  5. #5
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Please Login or Register  to view this content.
    HTH
    Carim

  6. #6
    Forum Contributor
    Join Date
    10-28-2003
    Location
    Happyville, USA
    MS-Off Ver
    365
    Posts
    300
    That worked great. Thank you so much.

    Eddie.

  7. #7
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Glad your problem's fixed

    Thanks for the feedback

    Carim

+ 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