ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Correct way to call active worksheet? (https://www.excelbanter.com/excel-programming/328565-correct-way-call-active-worksheet.html)

Locutis

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



galimi[_2_]

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




Don Guillett[_4_]

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

"Locutis" wrote in message
...
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





Tom Ogilvy

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" wrote in message
...
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

"Locutis" wrote in message
...
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







Don Guillett[_4_]

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

"Tom Ogilvy" wrote in message
...
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" wrote in message
...
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

"Locutis" wrote in message
...
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










All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com