Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatenate If Novice Excel Worksheet Functions 4 July 9th 09 10:05 PM
=CONCATENATE() help! shfcook Excel Worksheet Functions 4 September 14th 05 11:01 AM
I know how to concatenate ,can one de-concatenate to split date? QUICK BOOKS PROBLEM- New Users to Excel 1 July 26th 05 05:07 PM
CONCATENATE-1 AYPCN Excel Programming 1 March 9th 05 09:41 PM
CONCATENATE-1 AYPCN Excel Programming 0 March 9th 05 09:15 PM


All times are GMT +1. The time now is 09:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"