+ Reply to Thread
Results 1 to 13 of 13

Making a cell active.

  1. #1
    Registered User
    Join Date
    07-02-2013
    Location
    Shropshire,England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Making a cell active.

    Hi all, complete nooby here!.

    I have been trying for the last 2 weeks to make a cell the active cell in vba. I can do a macro, and it's fine, but when I cut and paste into a command button click module, it don't work. Excel tells me that a macro is translated into something vba understands, but I know this is not always strictly true especially with the dataform.(thx for whoever posted about the command mso solution).
    I have tried almost everything except the right thing, even to the point of copying and pasting find examples, but I am at a loss. I find that I can't use a variable in a Range statement cos of the syntax.
    My ultimate goal is to use a variable that I have stored on a sheet that has lots of ranges, to access a particular range for the end user to modify for himself for his own uses.
    Please Login or Register  to view this content.

    This is a quoting program for manufacturing, and this command is from a Main Menu button, to select another sheet and to make a cell active.
    Last edited by Pierre11; 07-09-2013 at 03:34 PM. Reason: Solved

  2. #2
    Registered User
    Join Date
    07-02-2013
    Location
    Shropshire,England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Making a cell active.

    I forgot to add that I am waiting for Vba for dummies to come in to the local library, and I would appreciate any help whatsoever.
    Thx.
    Pete.

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

    Re: Making a cell active.

    You do not need to use activate, this should do

    Please Login or Register  to view this content.
    OR

    Please Login or Register  to view this content.
    Last edited by AB33; 07-09-2013 at 01:15 PM.

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Making a cell active.

    Where do you have this code?
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  5. #5
    Registered User
    Join Date
    07-02-2013
    Location
    Shropshire,England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Making a cell active.

    Thx for ur answers. I get an error with the range statement whether it's integrated in a statement or in a single statement.
    I have this code in the main menu on a button.
    I am just figuring out how to upload the workbook.

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

    Re: Making a cell active.

    Go to advance then attachment.

  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: Making a cell active.

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  8. #8
    Registered User
    Join Date
    07-02-2013
    Location
    Shropshire,England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Making a cell active.

    Thx for that.
    I am using a combo box for the range to select, hit command button2 and trying to select whatever is in the combo box. I tried making 2 indexs to get R1C1 format into E1 on Infosht, but can't get that to work either.
    Hopefully u will b able to get the general gist of what I am doing.
    I have a few rem statements in command button 2 code which shows what I have tried.
    Attached Files Attached Files

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

    Re: Making a cell active.

    I don't see anything that's determine which cell to select based on what's been selected in the combobox.

    That is what you are trying to do isn't it, make a cell active based on the combobox selection.

  10. #10
    Registered User
    Join Date
    07-02-2013
    Location
    Shropshire,England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Making a cell active.

    @Norie, thx man that works
    Now all I have to do is try to use a variable to select the range to be modified.
    Thx for ur help guys, gonna add rep. to each, and if u can feel like helping further, would love ur input.
    Solved, thx again,
    Pete.

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

    Re: Making a cell active.

    Pete

    I notice you have a lot of named ranges, some of which match what's listed in the combobox.

    Are they relevant at all?

  12. #12
    Registered User
    Join Date
    07-02-2013
    Location
    Shropshire,England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Making a cell active.

    Yes it is, but I always kept getting an error in the range statement, so I thought I'd go back to square 1 to try and get any active cell to work. If I get that to work, then the next step is trying to use a variable.
    I tried Columns A:A in the right syntax, and got an error on that?
    The aim would be to get the value in E1 on Infosht as the active cell.

    Pete.

  13. #13
    Registered User
    Join Date
    07-02-2013
    Location
    Shropshire,England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Making a cell active.

    Yes they are relevant to the dropdown boxes in QuoteSht. There are a lot of variables in there, and each range on infosht is specific to a dropdown box in quotesht.
    If for example the cost of "Ally" in infosht, goes thru' the roof, the user needs to update the cost per tonne, to reflect in the final quote.
    Also as costs go up say in manpower (not on sht, but in hourly rates), these may need to be amended.
    Pete.

+ 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