+ Reply to Thread
Results 1 to 8 of 8

Select sheet and range at once

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Ventura, united States
    MS-Off Ver
    Excel 2010
    Posts
    346

    Select sheet and range at once

    Can anyone remind me why this doesn't work.

    sheets("sheet1").range("A1").select
    It will work if I separate them.

    sheets("sheet1").select
    range("A1").select
    and sometimes it works if I do this

    sheets("sheet1").range("A1").activate
    But I forget why the first version doesn't work.

  2. #2
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Select sheet and range at once

    Version 1 works fine for me (at least once I changed sheet1 to Sheet1 as my sheet has a capital letter at the start)
    Sheets("Sheet1").Range("A1").Select
    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  3. #3
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Ventura, united States
    MS-Off Ver
    Excel 2010
    Posts
    346

    Re: Select sheet and range at once

    Hmm. It definitely doesn't work for me, capitol letter or not, unless I am already on Sheet1.

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

    Re: Select sheet and range at once

    Hi, Jiptastic,

    why don´t you use
    Application.Goto Reference:=Sheets("Sheet1").Range("A1")
    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

  5. #5
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Select sheet and range at once

    Are you getting an error message?
    What happens if you run
    Sheets("Sheet1").Range("A1").Value = "111"

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

    Re: Select sheet and range at once

    Hi, WasWodge,

    if you´re not on the sheet and run your code RTF 1004 should show up - not with my sample though.

    Ciao,
    Holger

  7. #7
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Select sheet and range at once

    Hi, WasWodge,
    
    if you´re not on the sheet and run your code RTF 1004 should show up - not with my sample though.
    True. That's what comes of replying from your phone without testing. I was probably on the same sheet when I replied the other day. Apologies

    P.S. could have done with an embarrassed smiley
    Last edited by WasWodge; 05-09-2013 at 03:52 PM.

  8. #8
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Ventura, united States
    MS-Off Ver
    Excel 2010
    Posts
    346

    Re: Select sheet and range at once

    It gives run time error 1004. The code below runs fine. The application.Goto code does the job as well. I'm not sure what's easier, using the application code or just separating the lines of sheet and range.

    Sheets("Sheet1").Range("A1").Value = "111"

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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