+ Reply to Thread
Results 1 to 5 of 5

[Solved] Macro Column selection keeps defaulting to "C:x" instead of just "x"

  1. #1
    Registered User
    Join Date
    12-10-2014
    Location
    Philadelphia
    MS-Off Ver
    2010
    Posts
    18

    [Solved] Macro Column selection keeps defaulting to "C:x" instead of just "x"

    I'm new to macro, but most certainly not to excel formulas. I figured due to the logical approach this would be fairly simple with the "record macro" feature, but I'm growing frustrated. Note: this is office 2013.

    My goal is this:

    Click one of three buttons.

    Button 1 must show column F and hide G:I

    Button 2 must show column G and hide F, H:I

    Button 3 must show columns H:I and hide F:G

    Simple enough right?

    Everytime I get to the bold step utilizing the "step in" (F8) for visual basic instead of highlighting JUST column F (or any column i try to put in there), it selects C:F instead of just F:

    Sub Macro6()
    '
    ' Macro6 Macro
    '
    '

    '
    Range("F1").Select
    Columns("F").Select
    Selection.EntireColumn.Hidden = True
    Columns("H:I").Select
    Selection.EntireColumn.Hidden = True
    Columns("E").Select
    Selection.EntireColumn.Hidden = False
    End Sub


    Note: the above isn't the proper code, i've just been trying to troubleshoot what does what and how. I've narrowed it down to this reality...it keeps selecting C through whatever column. It's driving me mad. I've been working on this spreadsheet for 2 solid work weeks and this is tying me up. Please help
    Last edited by Cappytano; 12-14-2015 at 10:34 AM.

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2505
    Posts
    2,790

    Re: Macro Column selection keeps defaulting to "C:x" instead of just "x"

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-10-2014
    Location
    Philadelphia
    MS-Off Ver
    2010
    Posts
    18

    Re: Macro Column selection keeps defaulting to "C:x" instead of just "x"

    Thank you Skywriter

    I had to edit the B1, B2,B3 as they will be conflicted name wise but it did function how I needed it with a little tweaking.


    I am curious though. Do you know WHY my code was pulling column "C"? I want to understand so I don't repeat my error.

    I will mark this post solved after.

  4. #4
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    867

    Re: [Alt. Solution Found] Macro Column selection keeps defaulting to "C:x" instead of just

    Hi there and sorry for jumping in unannounced/uninvited..
    my guess is that you have somewhere a merged area between C and F columns...
    and when you select F column it selects the C:F columns because of the merged cells
    .. and don't forget to have fun!
    Bogdan.

    mark SOLVED and Add Reputation if my answer pleases you

  5. #5
    Registered User
    Join Date
    12-10-2014
    Location
    Philadelphia
    MS-Off Ver
    2010
    Posts
    18

    Re: [Alt. Solution Found] Macro Column selection keeps defaulting to "C:x" instead of just

    Quote Originally Posted by bulina2k View Post
    Hi there and sorry for jumping in unannounced/uninvited..
    my guess is that you have somewhere a merged area between C and F columns...
    and when you select F column it selects the C:F columns because of the merged cells

    Hit the nail on the head. Completely overlooked this.



    double-facepalm.jpg

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Excel 2010 -- "Visual Basic" "Macros" and "Record Macro" all disabled.
    By NicholasL in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-07-2017, 06:11 AM
  2. Update Macro to search column Bfor "Fail" and "Exception"
    By programct in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-10-2014, 02:32 PM
  3. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  4. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  5. [SOLVED] If there is any text in column "A$" on "sheet1" then move cell to column "A$" on "sheet2"
    By ckgeary in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 08:28 PM
  6. Replies: 2
    Last Post: 06-06-2013, 12:45 PM
  7. How can i copy value from "HTMLText"(EMBED("Forms.HTML:Text","")),using Macro
    By andrewyang in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2010, 12:47 AM

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