+ Reply to Thread
Results 1 to 8 of 8

Use counter value with letter to get dimmed range and use to get new value

  1. #1
    Forum Contributor
    Join Date
    01-30-2014
    Location
    England
    MS-Off Ver
    MS Office 2010, 2007, 2003
    Posts
    149

    Use counter value with letter to get dimmed range and use to get new value

    Not sure if I've explained that well enough and kept it short, so I'll explain better:

    At the beginning of my sub, I have a loop which gets the columns of four cells with specific text in them.
    Later in the same sub, I need to offset to each of them consecutively.
    The way I'm doing this at the moment is:
    Please Login or Register  to view this content.
    but I get Error 13 on 'ActiveCell.Offset(0,gcol).Select'

    Anyone know how I can get around this please?
    Last edited by Aaron092; 11-17-2014 at 08:20 AM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Use counter value with letter to get dimmed range and use to get new value

    Hi, Aaron092,

    not clear what you are after...

    One guess might be to avoid Selects of all kinds:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,422

    Re: Use counter value with letter to get dimmed range and use to get new value

    In
    Please Login or Register  to view this content.
    gcol needs to be a number. Clearly, it will be a text string with the value "q" plus a number from 1 to 4.

    What is in the cells? What are you trying to achieve?

    Suggest you post a sample workbook.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Contributor
    Join Date
    01-30-2014
    Location
    England
    MS-Off Ver
    MS Office 2010, 2007, 2003
    Posts
    149

    Re: Use counter value with letter to get dimmed range and use to get new value

    Hi both

    Thanks for your replies.
    I've attached a sample to this for you.
    EESR(DEV).xlsm

    What I'm trying to achieve is offset to each of the orange cells column in the workbook, then at the bottom of the column (as it will have a load of data in it) put some values.
    This part I've done, but each of the orange cells (Questions) move location depending on whats in the first few columns.

    So what I need to do is find each last question in each set of questions (four in total), get their columns, then offset to the columns later in the sub (where the blue is).

    It's just that loop I'm having a problem with - getting the final question column letters, and using these to offset.

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Use counter value with letter to get dimmed range and use to get new value

    Hi, Aaron092,

    my advice for the person who sampled the code:
    Please Login or Register  to view this content.

    Range("AH1") shows trailing blanks - is that by defauilt?

    To collect the columns for the searched items you may use something like
    Please Login or Register  to view this content.
    Ciao,
    Holger

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,422

    Re: Use counter value with letter to get dimmed range and use to get new value

    If I'm honest, I don't really understand your code or what you plan to do. Respect to Holger.

    I think that I have done something very similar ... The code creates an array of questions, then loops through it to determine first the column and then the last row of the range relating to the question. It offsets it (to reach the blue area) and resizes it (to the size of the blue area) and then, for the sake of the demonstration, puts the question in each of the cells in the range. No sheets, ranges or cells are selected.

    Note that you have an inconsistent number of trailing spaces on questions 2, 3 and 4.

    Please Login or Register  to view this content.

    Regards, TMS

  7. #7
    Forum Contributor
    Join Date
    01-30-2014
    Location
    England
    MS-Off Ver
    MS Office 2010, 2007, 2003
    Posts
    149

    Re: Use counter value with letter to get dimmed range and use to get new value

    The inconsistency is the bane of my life, but it has to be there

    Thank you both - I think both of you have posted something that would do what I'm looking for.
    Sorry for any confusion

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,422

    Re: Use counter value with letter to get dimmed range and use to get new value

    You're welcome. Thanks for the rep.

+ 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. Insert rows dimmed - why?
    By KathrynBassett in forum Excel General
    Replies: 2
    Last Post: 10-05-2009, 01:54 PM
  2. [SOLVED] Tools/Options/Charts-Active cells is dimmed. Want to select leave
    By teds in forum Excel Charting & Pivots
    Replies: 9
    Last Post: 04-13-2006, 11:10 AM
  3. [SOLVED] MS Excel: Why would the Goal Seek option be dimmed for a book?
    By Janine in forum Excel General
    Replies: 4
    Last Post: 03-09-2006, 03:55 PM
  4. How to select a range using a counter
    By gopher in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-28-2005, 01:42 PM
  5. [SOLVED] excell 2002 dimmed command button
    By in forum Excel General
    Replies: 1
    Last Post: 02-12-2005, 08:06 PM

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