+ Reply to Thread
Results 1 to 10 of 10

How to use ActiveCell Adress in variable?

  1. #1
    Registered User
    Join Date
    05-11-2010
    Location
    Helsinki, Finland
    MS-Off Ver
    Excel 2007
    Posts
    5

    How to use ActiveCell Adress in variable?

    Hello Gurus!

    I've been pounding my head to the wall with an apparently simple problem. I need to store the adress of the ActiveCell in a variable and then use it in Range selection.

    Sounds easy but I just keep getting a global error message.

    I just need to select an area and copy it. Here is my code:

    Please Login or Register  to view this content.
    From the immediate window I can see that CellLoc gets the value "I18" but when I try to use it in the range selection I get a global error message.

    Any tips are greatly appreciated!


    rgds,
    cas
    Last edited by Castor77; 05-11-2010 at 10:20 AM.

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to use ActiveCell Adress in variable?

    Please put code tags around your code or we can't answer (it's a simple fix).
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    05-11-2010
    Location
    Helsinki, Finland
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: How to use ActiveCell Adress in variable?

    Ok, tagged!

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to use ActiveCell Adress in variable?

    You need the variable outside the quotes:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-11-2010
    Location
    Helsinki, Finland
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: How to use ActiveCell Adress in variable?

    OMG, I feel quite stupid right now...

    Anyway, thank you for your swift reply, great job!


    rgds,
    Cas

  6. #6
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,218

    Re: How to use ActiveCell Adress in variable?

    Hi Try this

    Please Login or Register  to view this content.
    Range("B17:" & CellLoc).Select

    Okay to late again!

  7. #7
    Registered User
    Join Date
    05-11-2010
    Location
    Helsinki, Finland
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: How to use ActiveCell Adress in variable?

    Hi,

    I'm still wondering... How should the syntax be written when you want to use ONLY variables to declare to range?

    Here is an example:

    Please Login or Register  to view this content.
    Thx!


    Rgds,
    Cas

  8. #8
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to use ActiveCell Adress in variable?

    Range will actually accept two string arguments:
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-11-2010
    Location
    Helsinki, Finland
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: How to use ActiveCell Adress in variable?

    Great info!

    Thanks again!

    -Cas-

  10. #10
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,218

    Re: How to use ActiveCell Adress in variable?

    I think this does what you asked for in your PM

    Please Login or Register  to view this content.

    I would avoid using ActiveCell.Select altogether but I don't know your actual ranges

    Probably better using Find in the Column that has "Result" & "End Result"

    Cheers
    Last edited by Marcol; 05-11-2010 at 11:30 AM.

+ 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