![]() |
|
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Join Date: Oct 2008
Posts: 681
|
I want to create a string of text to use as a variable. problem is one of the strings i want to combine is already a text string. i want to dot his:
LastLocationxxx = concatenate("lastlocation" & VesselNameActive) where vesselnameactive is already a textstring. i am wanting a final product of "lastlocationGI40F", if vessnameactive was "GI40F". how come concatenate does not work?? |
|
|
|
|
|
#2 |
|
Join Date: Jun 2009
Location: Russia
Posts: 266
|
Code:
LastLocationxxx = "lastlocation" & VesselNameActive |
|
|
|
|
|
#3 |
|
Join Date: Dec 2008
Location: Phoenix, Arizona
Posts: 2,578
|
Hi Plost,
In vba, just: LastLocationxxx = "lastlocation" & VesselNameActive Hope that helps, Mark |
|
|
|
|
|
#4 |
|
Join Date: Oct 2008
Posts: 681
|
okay i figuered out if i remove the concatenate then it works. but here is the tricky part:
that that puts together as a string is the name of another varibale that is defined. I am wanting to use the value which represent LastlocationGI40F and not the actual text string. here are the few lines of code: [code] LastLocationxxx = ("LastLocation" & VesselNameActive) If i > 2 Then If ActiveValue <> LastLocationxxx And VesselNameCompair = VesselNameActive Then [\code] In other words the part in red when put together is another varibale which holds the value i want to appear for the text in green. right now this code place the combined text string in the green text instead of the value for that variable. |
|
|
|
|
|
#5 |
|
Join Date: Oct 2008
Posts: 681
|
this doesnt work either:
LastLocationxxx = Evaluate("LastLocation" & VesselNameActive).Value If i > 2 Then If ActiveValue <> LastLocationxxx And VesselNameCompair = VesselNameActive Then |
|
|
|
|
|
#6 |
|
Join Date: Oct 2008
Posts: 681
|
there has to be a way to pull the value from a combined text string that matches a variable. or convert the text string to the variable..or something. no one has a clue?
|
|
|
|
|
|
#7 |
|
MrExcel MVP
Join Date: Mar 2004
Location: Oregon
Posts: 13,274
|
Sorry, you can't use a text string or another variable as a variable name.
In this example, the first line is correct, the second one is not: LastLocation7 = 7 "LastLocation" & "7" = 7
__________________
Office 2007 Last edited by HOTPEPPER; Jun 26th, 2009 at 11:37 PM. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|