+ Reply to Thread
Results 1 to 10 of 10

Using code to select cells that are two cells to the left of the currently active cell

  1. #1
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Using code to select cells that are two cells to the left of the currently active cell

    Hello,

    I have a macro that looks specifically for the two characters "1F" in column C of my excel file. When it finds a cell containing 1F, it selects the cell and moves it to another sheet, but I have important information in columns A and B that I want to move with it. Is there a way to command my macro to select all three adjacent cells in A, B, and C whenever it finds a 1F in column C? I can reword if that is too confusing to understand. Thank you in advance!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Using code to select cells that are two cells to the left of the currently active cell

    Can you post your current code?

    In general to select the 2 columns to the left, and include the original column you would use something like this.
    Please Login or Register  to view this content.
    That's how you would select but you rarely, if ever, need to select.
    If posting code please use code tags, see here.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Using code to select cells that are two cells to the left of the currently active cell

    Assuming your find set is called findme.

    Please Login or Register  to view this content.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Using code to select cells that are two cells to the left of the currently active cell

    Hi,

    One way, assuming you are copying or cutting that cell would be to use something like

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Using code to select cells that are two cells to the left of the currently active cell

    I think Norie's post helps me the most. But my code is this:

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Using code to select cells that are two cells to the left of the currently active cell

    Assuming you want to copy and paste
    Please Login or Register  to view this content.
    Last edited by AB33; 06-25-2013 at 12:45 PM.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Using code to select cells that are two cells to the left of the currently active cell

    Are you always copying to BITmove?

    By the way, why are you repeating the loop if you find '1F'?

    If you wanted to copy columns A,B and C from 'zEXP' to 'Overview' starting at X15 and going down try this.
    Please Login or Register  to view this content.
    If that's not what you want can you explaing further?

  8. #8
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Using code to select cells that are two cells to the left of the currently active cell

    Alright. I messed around with my code a little bit and came up with this. I still need to find a way to move the other two cells with the one in column C. Sorry for the confusion.

    Please Login or Register  to view this content.
    Norie: I have no idea what "Are you always copying to BITmove?" means.

    AB33: I think the code you gave me will work, but I had to change a few things to mine so I'm not sure how to fix that exactly.

    Thanks again guys

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Using code to select cells that are two cells to the left of the currently active cell

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Using code to select cells that are two cells to the left of the currently active cell

    That worked perfectly, thanks a lot AB33

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    That was a typo.

    It should have been always copying to X15 on 'Overview'.

    Anyways, the only part missing from my code was the paste special.
    Last edited by Norie; 06-25-2013 at 03:59 PM.

+ 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