Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default concatenation w/in a macro

I'm trying to perform a concatenation within a macro using the recording fn,
but the syntax written into the macro is:

+"*"&R[-1]C&"*"

and once I copy this macro into my file, the concatenation obviously doesn't
work.

The concatenation is to generate barcode fields for the data in the cell
above. so, it looks like +"*"&A2&"*" (given my source data is in cell A2).

why is the macro converting this to +"*"&R[-1]C&"*"? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default concatenation w/in a macro

If you look at the code that was recorded, you'll see that it's using the
..formulaR1C1 property. That means that it's building a string that uses R1C1
reference style--not A1 reference style.

Activecell.formulaR1C1 = "=""*""&R[-1]C&""*"""

Will build a formula to concatenate an asterisk with the value of the cell above
the cell getting the formula (r[-1] is the previous row and c means the same
column.)

And I bet you changed the recorded code to something else before you posted in
the newsgroups. (You lost some double quotes.)

If this doesn't help, you'll want to post more of your code.

wilson@irco wrote:

I'm trying to perform a concatenation within a macro using the recording fn,
but the syntax written into the macro is:

+"*"&R[-1]C&"*"

and once I copy this macro into my file, the concatenation obviously doesn't
work.

The concatenation is to generate barcode fields for the data in the cell
above. so, it looks like +"*"&A2&"*" (given my source data is in cell A2).

why is the macro converting this to +"*"&R[-1]C&"*"? Thanks.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default concatenation w/in a macro

Thanks Dave; you're right I missed the double quotes, they were in there.
For some reason when I replaced the recorded code with your code, it worked.
They both looked exactly alike.

Thanks for the help.

"Dave Peterson" wrote:

If you look at the code that was recorded, you'll see that it's using the
..formulaR1C1 property. That means that it's building a string that uses R1C1
reference style--not A1 reference style.

Activecell.formulaR1C1 = "=""*""&R[-1]C&""*"""

Will build a formula to concatenate an asterisk with the value of the cell above
the cell getting the formula (r[-1] is the previous row and c means the same
column.)

And I bet you changed the recorded code to something else before you posted in
the newsgroups. (You lost some double quotes.)

If this doesn't help, you'll want to post more of your code.

wilson@irco wrote:

I'm trying to perform a concatenation within a macro using the recording fn,
but the syntax written into the macro is:

+"*"&R[-1]C&"*"

and once I copy this macro into my file, the concatenation obviously doesn't
work.

The concatenation is to generate barcode fields for the data in the cell
above. so, it looks like +"*"&A2&"*" (given my source data is in cell A2).

why is the macro converting this to +"*"&R[-1]C&"*"? Thanks.


--

Dave Peterson

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
Concatenation orquidea Excel Discussion (Misc queries) 6 January 11th 08 08:19 PM
Concatenation Harry Excel Worksheet Functions 2 July 17th 06 08:17 PM
Concatenation Ken Excel Discussion (Misc queries) 1 April 12th 06 12:26 PM
concatenation mattguerilla Excel Discussion (Misc queries) 3 January 27th 06 12:47 AM
Concatenation using IF AND - Possible? Col Excel Worksheet Functions 3 April 30th 05 02:22 AM


All times are GMT +1. The time now is 01:50 PM.

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

About Us

"It's about Microsoft Excel"