+ Reply to Thread
Results 1 to 5 of 5

Correct way to call active worksheet?

  1. #1
    Locutis
    Guest

    Correct way to call active worksheet?

    Hello,

    What is the correct way to call upon the active worksheet?
    I want my code to call the active worksheet (ActiveSheet) that I am
    currently in, rather than calling up a certain sheet by name as I am doing
    below:

    Private Sub CBWP_Click()
    Worksheets("BIDWORKUP").Range("B48").Value = "Waterproofing"
    Worksheets("BIDWORKUP").Range("H48").Value = 1.45
    Worksheets("BIDWORKUP").Range("B62").Value = "Waterproofing"
    Worksheets("BIDWORKUP").Range("H62").Value = 1#
    End Sub

    Help!

    LB



  2. #2
    galimi
    Guest

    RE: Correct way to call active worksheet?

    Replace Worksheets("name_of_sheet") with ActiveSheet
    --
    http://HelpExcel.com
    1-888-INGENIO
    1-888-464-3646
    x0197758


    "Locutis" wrote:

    > Hello,
    >
    > What is the correct way to call upon the active worksheet?
    > I want my code to call the active worksheet (ActiveSheet) that I am
    > currently in, rather than calling up a certain sheet by name as I am doing
    > below:
    >
    > Private Sub CBWP_Click()
    > Worksheets("BIDWORKUP").Range("B48").Value = "Waterproofing"
    > Worksheets("BIDWORKUP").Range("H48").Value = 1.45
    > Worksheets("BIDWORKUP").Range("B62").Value = "Waterproofing"
    > Worksheets("BIDWORKUP").Range("H62").Value = 1#
    > End Sub
    >
    > Help!
    >
    > LB
    >
    >
    >


  3. #3
    Don Guillett
    Guest

    Re: Correct way to call active worksheet?

    this might be better

    with activeworksheet
    ..Range("B48") = "Waterproofing"
    ..Range("H48") = 1.45
    ..Range("B62") = "Waterproofing"
    ..Range("H62") = 1#
    end with

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "Locutis" <[email protected]> wrote in message
    news:[email protected]...
    > Hello,
    >
    > What is the correct way to call upon the active worksheet?
    > I want my code to call the active worksheet (ActiveSheet) that I am
    > currently in, rather than calling up a certain sheet by name as I am doing
    > below:
    >
    > Private Sub CBWP_Click()
    > Worksheets("BIDWORKUP").Range("B48").Value = "Waterproofing"
    > Worksheets("BIDWORKUP").Range("H48").Value = 1.45
    > Worksheets("BIDWORKUP").Range("B62").Value = "Waterproofing"
    > Worksheets("BIDWORKUP").Range("H62").Value = 1#
    > End Sub
    >
    > Help!
    >
    > LB
    >
    >




  4. #4
    Tom Ogilvy
    Guest

    Re: Correct way to call active worksheet?

    Think Don actually meant:


    with activesheet
    ..Range("B48") = "Waterproofing"
    ..Range("H48") = 1.45
    ..Range("B62") = "Waterproofing"
    ..Range("H62") = 1#
    end with

    since there is no ActiveWorksheet object (although I try to use it all the
    time <g>)

    --
    Regards,
    Tom Ogilvy'


    "Don Guillett" <[email protected]> wrote in message
    news:[email protected]...
    > this might be better
    >
    > with activeworksheet
    > .Range("B48") = "Waterproofing"
    > .Range("H48") = 1.45
    > .Range("B62") = "Waterproofing"
    > .Range("H62") = 1#
    > end with
    >
    > --
    > Don Guillett
    > SalesAid Software
    > [email protected]
    > "Locutis" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hello,
    > >
    > > What is the correct way to call upon the active worksheet?
    > > I want my code to call the active worksheet (ActiveSheet) that I am
    > > currently in, rather than calling up a certain sheet by name as I am

    doing
    > > below:
    > >
    > > Private Sub CBWP_Click()
    > > Worksheets("BIDWORKUP").Range("B48").Value = "Waterproofing"
    > > Worksheets("BIDWORKUP").Range("H48").Value = 1.45
    > > Worksheets("BIDWORKUP").Range("B62").Value = "Waterproofing"
    > > Worksheets("BIDWORKUP").Range("H62").Value = 1#
    > > End Sub
    > >
    > > Help!
    > >
    > > LB
    > >
    > >

    >
    >




  5. #5
    Don Guillett
    Guest

    Re: Correct way to call active worksheet?

    Darn.

    with activesheet
    .Range("B48,b62") = "Waterproofing" 'improvement to make up for it
    .Range("H48") = 1.45
    .Range("H62") = 1#
    end with


    --
    Don Guillett
    SalesAid Software
    [email protected]
    "Tom Ogilvy" <[email protected]> wrote in message
    news:%[email protected]...
    > Think Don actually meant:
    >
    >
    > with activesheet
    > .Range("B48") = "Waterproofing"
    > .Range("H48") = 1.45
    > .Range("B62") = "Waterproofing"
    > .Range("H62") = 1#
    > end with
    >
    > since there is no ActiveWorksheet object (although I try to use it all

    the
    > time <g>)
    >
    > --
    > Regards,
    > Tom Ogilvy'
    >
    >
    > "Don Guillett" <[email protected]> wrote in message
    > news:[email protected]...
    > > this might be better
    > >
    > > with activeworksheet
    > > .Range("B48") = "Waterproofing"
    > > .Range("H48") = 1.45
    > > .Range("B62") = "Waterproofing"
    > > .Range("H62") = 1#
    > > end with
    > >
    > > --
    > > Don Guillett
    > > SalesAid Software
    > > [email protected]
    > > "Locutis" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > Hello,
    > > >
    > > > What is the correct way to call upon the active worksheet?
    > > > I want my code to call the active worksheet (ActiveSheet) that I am
    > > > currently in, rather than calling up a certain sheet by name as I am

    > doing
    > > > below:
    > > >
    > > > Private Sub CBWP_Click()
    > > > Worksheets("BIDWORKUP").Range("B48").Value = "Waterproofing"
    > > > Worksheets("BIDWORKUP").Range("H48").Value = 1.45
    > > > Worksheets("BIDWORKUP").Range("B62").Value = "Waterproofing"
    > > > Worksheets("BIDWORKUP").Range("H62").Value = 1#
    > > > End Sub
    > > >
    > > > Help!
    > > >
    > > > LB
    > > >
    > > >

    > >
    > >

    >
    >




+ 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