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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of variables...

Status
Not open for further replies.

hudhwk

Programmer
Jan 28, 2003
80
MX
Hi folks!

This may sound silly, but I need to do something that I know how to do in FoxPro very easly but just can't seem to find the right syntax in VB...

I have a Select statement:
Select Case Worksheets("Total").Range("G2")
Case "Data 1"
m_Data = Worksheets("Data 1")

Here is the thing. I need to save in the variable m_Data, not the contents but the words "Worksheets("Data 1")", the reason? Simple, because later I need to invoque the contents of m_Data to be used like this:

Worksheets("Total").Range("B9").Value = m_Data.Range("D4")

In this case, the contents of m_Data have to be "converted" into something like this:

Worksheets("Total").Range("B9").Value = Worksheets("Data 1").Range("D4")

In FoxPro I use a "&" command to invoque a regular content in a variable that can be a reserved word, but just can't seem to find anything like that in VB...

Any help will be very welcomed!!!

Thanks in advance folks...

HudHwk
"Here comes the Hawk!!!"
 
For both of them I get a list of objects information and their properties...

I am wondering... CodeName and Name can be a problem? I mean, I am using Name and not CodeName, can that be an issue?

For Worksheets("Resumen") this is the Name property information:
: Name : "Resumen" : String : Sheet1.CommandButton1_Click

For Worksheets(m_Ejecutivo) this is the Name property information:
: Name : "Lorenzo Huerta Alvarado" : String : Sheet1.CommandButton1_Click

It looks fine, it should be bringing back the information... this is weird.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HudHwk
"Here comes the Hawk!!!...
 




And in the Watch Window, what is the value of
Code:
Worksheets(Lorenzo Huerta Alvarado).Range("D4").Value


Skip,

[glasses] [red][/red]
[tongue]
 
Its is 5,000 the value that should be...


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HudHwk
"Here comes the Hawk!!!...
 



and Sheets "Resumen" & "Lorenzo Huerta Alvarado" are both in the workbook that the CommandButton is in?

If the answer is YES, then I have no other ideas.

Skip,

[glasses] [red][/red]
[tongue]
 
LOL...

Yes they are buddy, and don't worry I do really appreciate your time and great ideas...

I'll keep checking what I am doing wrong, I am almost sure that somwhere in the code I am making a mistake.

Thanks for all!


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HudHwk
"Here comes the Hawk!!!...
 




If your workbook does not contain sensitive material, I'd be willing to look at it if you would send it...

ii36250 at bellhelicopter dot textron dot com

Please respond here first.

Skip,

[glasses] [red][/red]
[tongue]
 
When you run into a lot of times on the same error, you simply don't see the obvious...

Worksheet(Resumen), what is wrong with that???... the ""!!!

Well, this is the last time I promise this is going to happen.

Thanks folks for all your help and patience...

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HudHwk
"Here comes the Hawk!!!...
 




I'm TOTALLY confused...
[highlight yellow]
"For Worksheets([red]"[/red]Resumen[red]"[/red]) this is the Name property information:
: Name : "Resumen" : String : Sheet1.CommandButton1_Click

For Worksheets(m_Ejecutivo) this is the Name property information:
: Name : "Lorenzo Huerta Alvarado" : String : Sheet1.CommandButton1_Click

It looks fine, it should be bringing back the information... this is weird. "
[/highlight]


Skip,

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

Part and Inventory Search

Sponsor

Back
Top