Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
concatenate with vba
Hi!
I have first name in A1 and last name in A2 When I use the syntax Sheets("Extract").Range("A" & ERow).Value = ActiveCell.Offset(0, -2).Value & ActiveCell.Offset(0, -3).Value Value of ERow is 1 Offset -2 is the first name Offset -3 is the last name VBA does not support "&" to get both the names in one cell of a different sheet? Please help |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
concatenate with vba
I bet that the activecell isn't what you think it should be.
Maybe adding: msgbox activecell.address(external:=true) to your code will help you debug the problem. Maxi wrote: Hi! I have first name in A1 and last name in A2 When I use the syntax Sheets("Extract").Range("A" & ERow).Value = ActiveCell.Offset(0, -2).Value & ActiveCell.Offset(0, -3).Value Value of ERow is 1 Offset -2 is the first name Offset -3 is the last name VBA does not support "&" to get both the names in one cell of a different sheet? Please help -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
concatenate with vba
maybe not the ideal way, but
Declare 2 variables Set Var1 = ActiveCell.Offset(0,-2) Set VAr2 = ActiveCell.Offset(0,-3) Sheets("Exrtract").Range("A" & ERow) = Var1 & Var2 HTH "Maxi" wrote: Hi! I have first name in A1 and last name in A2 When I use the syntax Sheets("Extract").Range("A" & ERow).Value = ActiveCell.Offset(0, -2).Value & ActiveCell.Offset(0, -3).Value Value of ERow is 1 Offset -2 is the first name Offset -3 is the last name VBA does not support "&" to get both the names in one cell of a different sheet? Please help |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
concatenate with vba
Thanx Steve, it worked
One more question. How do I remove the last character of var2 variable? For instance: var1 has Justin var2 has Kemp, I need only Justin Kemp after concatenation. Thanx On Jul 2, 8:42 pm, steve_doc wrote: maybe not the ideal way, but Declare 2 variables Set Var1 = ActiveCell.Offset(0,-2) Set VAr2 = ActiveCell.Offset(0,-3) Sheets("Exrtract").Range("A" & ERow) = Var1 & Var2 HTH "Maxi" wrote: Hi! I have first name in A1 and last name in A2 When I use the syntax Sheets("Extract").Range("A" & ERow).Value = ActiveCell.Offset(0, -2).Value & ActiveCell.Offset(0, -3).Value Value of ERow is 1 Offset -2 is the first name Offset -3 is the last name VBA does not support "&" to get both the names in one cell of a different sheet? Please help- Hide quoted text - - Show quoted text - |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
concatenate with vba
VBA does not support "&" to get both the names in one cell of a
different sheet? Yes, it does. However, your code will fail if ActiveCell is in columns A-C, because it can't go 3 columns left. Are you getting an error message? If so, what kind? Hth, Merjet |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
concatenate with vba
I was able to remove the last character... Thanx for your help
On Jul 2, 8:48 pm, Maxi wrote: Thanx Steve, it worked One more question. How do I remove the last character of var2 variable? For instance: var1 has Justin var2 has Kemp, I need only Justin Kemp after concatenation. Thanx On Jul 2, 8:42 pm, steve_doc wrote: maybe not the ideal way, but Declare 2 variables Set Var1 = ActiveCell.Offset(0,-2) Set VAr2 = ActiveCell.Offset(0,-3) Sheets("Exrtract").Range("A" & ERow) = Var1 & Var2 HTH "Maxi" wrote: Hi! I have first name in A1 and last name in A2 When I use the syntax Sheets("Extract").Range("A" & ERow).Value = ActiveCell.Offset(0, -2).Value & ActiveCell.Offset(0, -3).Value Value of ERow is 1 Offset -2 is the first name Offset -3 is the last name VBA does not support "&" to get both the names in one cell of a different sheet? Please help- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Concatenate If | Excel Worksheet Functions | |||
=CONCATENATE() help! | Excel Worksheet Functions | |||
I know how to concatenate ,can one de-concatenate to split date? | New Users to Excel | |||
CONCATENATE-1 | Excel Programming | |||
CONCATENATE-1 | Excel Programming |