Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting string in Excel

Status
Not open for further replies.

krets

Technical User
Dec 29, 2006
214
US
What I would like to do is set a variable based on a cell value in Excel. I've never done this before and can't seem to find a good reference.

Like:
Code:
Sub MySub()
Dim mVar as String

If ActiveSheet.Range("A1") = "Cell 200" Then
 mVar = I want to set the variable to something like "Week1!A3:A11"
End If

End Sub


 



Hi,
Code:
 mVar = Sheets("Week1).Range("A3:A11").Value
If you have the row limits in variables...
Code:
 mVar = Sheets("Week1).Range(Sheets("Week1).Cells(RowStrt, "A"), Sheets("Week1).Cells(RowEnd, "A")).Value




Skip,

[glasses] [red][/red]
[tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top