ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing objects on other Worksheets with Variables (https://www.excelbanter.com/excel-programming/274034-changing-objects-other-worksheets-variables.html)

Dave Baranas

Changing objects on other Worksheets with Variables
 
I am working on a spreadsheet that has 400+ sheets and I need to
change controls on many different sheets from many different sheets. 1
sheet needs to change things on whatever sheet has been selected from
a combobox

If ComboBox1 = "certainvalue" ' ComboBox with list of many sheets
Worksheets("certainworksheet").Activate ' Goes to that sheet
DoSomeThing ' Procedure that will change lots of values on selected
sheet
Set a Variable to This Sheet Name' I CAN'T FIGURE WHAT TYPE TO PUT
HERE!!!
End If

DoSomething()
If CheckBox1.Value = True Then
OtherSheet.ComboBox.Value = "Something" ' I CAN'T FIGURE OUT HOW TO
USE A VARIABLE "Othersheet" even though I can get a variable who's
value is right it gives errors

Any Help would be appreciated. I have combed through the usenet and
VBA sites looking for something as simple as using a variable name
like this and nothing.

Thanks in Advance

Dave Baranas

Bob Phillips[_5_]

Changing objects on other Worksheets with Variables
 


--

HTH

Bob Phillips

"Dave Baranas" wrote in message
om...
I am working on a spreadsheet that has 400+ sheets and I need to
change controls on many different sheets from many different sheets. 1
sheet needs to change things on whatever sheet has been selected from
a combobox

If ComboBox1 = "certainvalue" ' ComboBox with list of many sheets
Worksheets("certainworksheet").Activate ' Goes to that sheet
DoSomeThing ' Procedure that will change lots of values on selected
sheet
Set a Variable to This Sheet Name' I CAN'T FIGURE WHAT TYPE TO PUT
HERE!!!
End If

DoSomething()
If CheckBox1.Value = True Then
OtherSheet.ComboBox.Value = "Something" ' I CAN'T FIGURE OUT HOW TO
USE A VARIABLE "Othersheet" even though I can get a variable who's
value is right it gives errors

Any Help would be appreciated. I have combed through the usenet and
VBA sites looking for something as simple as using a variable name
like this and nothing.

Thanks in Advance

Dave Baranas




Bob Phillips[_5_]

Changing objects on other Worksheets with Variables
 
Dave,

If I understand the question, you need

Set oWS = Worksheets(Combobox1.Value)


oWS.Range("A1") = "value on selected worklsheet"

--

HTH

Bob Phillips

"Dave Baranas" wrote in message
om...
I am working on a spreadsheet that has 400+ sheets and I need to
change controls on many different sheets from many different sheets. 1
sheet needs to change things on whatever sheet has been selected from
a combobox

If ComboBox1 = "certainvalue" ' ComboBox with list of many sheets
Worksheets("certainworksheet").Activate ' Goes to that sheet
DoSomeThing ' Procedure that will change lots of values on selected
sheet
Set a Variable to This Sheet Name' I CAN'T FIGURE WHAT TYPE TO PUT
HERE!!!
End If

DoSomething()
If CheckBox1.Value = True Then
OtherSheet.ComboBox.Value = "Something" ' I CAN'T FIGURE OUT HOW TO
USE A VARIABLE "Othersheet" even though I can get a variable who's
value is right it gives errors

Any Help would be appreciated. I have combed through the usenet and
VBA sites looking for something as simple as using a variable name
like this and nothing.

Thanks in Advance

Dave Baranas




Dave Baranas

Changing objects on other Worksheets with Variables
 
Thanks Bob!!!

It Works!


"Bob Phillips" wrote in message ...
Dave,

If I understand the question, you need

Set oWS = Worksheets(Combobox1.Value)


oWS.Range("A1") = "value on selected worklsheet"

--

HTH

Bob Phillips

"Dave Baranas" wrote in message
om...
I am working on a spreadsheet that has 400+ sheets and I need to
change controls on many different sheets from many different sheets. 1
sheet needs to change things on whatever sheet has been selected from
a combobox

If ComboBox1 = "certainvalue" ' ComboBox with list of many sheets
Worksheets("certainworksheet").Activate ' Goes to that sheet
DoSomeThing ' Procedure that will change lots of values on selected
sheet
Set a Variable to This Sheet Name' I CAN'T FIGURE WHAT TYPE TO PUT
HERE!!!
End If

DoSomething()
If CheckBox1.Value = True Then
OtherSheet.ComboBox.Value = "Something" ' I CAN'T FIGURE OUT HOW TO
USE A VARIABLE "Othersheet" even though I can get a variable who's
value is right it gives errors

Any Help would be appreciated. I have combed through the usenet and
VBA sites looking for something as simple as using a variable name
like this and nothing.

Thanks in Advance

Dave Baranas



All times are GMT +1. The time now is 04:19 AM.

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