+ Reply to Thread
Results 1 to 6 of 6

Move cell based on contents (VBA)

  1. #1
    Registered User
    Join Date
    08-25-2010
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2003
    Posts
    7

    Move cell based on contents (VBA)

    Hi All,

    I'm trying to use VBA to move a cell one column to the right if it contains a comma, below is the code I'm using.

    My problem is that the code only looks to see if the whole cell value is a comma - I need it to work even if there is other text in the cell with the comma; I tried putting an asterisk either side of the comma in the code but it flagged an error...

    Any tips would be appreciated, I'm probably missing something really basic!


    Please Login or Register  to view this content.
    Last edited by BaronDJB; 09-02-2010 at 11:33 AM. Reason: Solved and inserted code tags

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Move cell based on contents (VBA)

    Hi,

    Please edit your post to include code tags.

    Please Login or Register  to view this content.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    08-25-2010
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Move cell based on contents (VBA)

    Many thanks for your help, being new to VBA and learning on the hoof isn't the best combination!

  4. #4
    Registered User
    Join Date
    08-24-2005
    Location
    Ireland
    MS-Off Ver
    O365
    Posts
    75

    Re: Move cell based on contents (VBA)

    hello. i am trying to use this code, but using : instead of ,.. but its not recognizing the : because its reading the cell as text format. anyone help?

  5. #5
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Move cell based on contents (VBA)

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

  6. #6
    Registered User
    Join Date
    08-24-2005
    Location
    Ireland
    MS-Off Ver
    O365
    Posts
    75

    Re: Move cell based on contents (VBA)

    ok. understood. thanks

+ 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