Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro needed


all, thanks for any response.

I would like to make a macro to take the contents of 3 columns of 20 numbers
and letters, and combine them into one column to form a label
number.....this is relevant for a label making program that allows an Excel
import.

for example

A1 Port1 KVM

would turn into
A1-Port1-KVM

any help is appreciated.





--

Rich........
my AOL instant messenger shhhbalto

use this link to donate a calling card to our troops
https://thor.aafes.com/scs/product.aspx?cid=2

this site helps our wounded soldiers adapt
http://www.homesforourtroops.org/pages/4/index.htm

Frustrate the evildoers, lead a good and prosperous life

All that is needed for evil to triumph is for good people to stand by and do
nothing.....Edmund Burke





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Macro needed

Hi
you can use a formula like
=A1 & "-" & B1 & "-" & C1
and copy this down for all rows

--
Regards
Frank Kabel
Frankfurt, Germany


Rich wrote:
all, thanks for any response.

I would like to make a macro to take the contents of 3 columns of 20
numbers and letters, and combine them into one column to form a label
number.....this is relevant for a label making program that allows an
Excel import.

for example

A1 Port1 KVM

would turn into
A1-Port1-KVM

any help is appreciated.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Macro needed

If you need a macro

cRows = Cells(Rows.Count,"A").End(xlUp).Row
For i = 1 To cRows
With Cells(i,"A")
If Cells(i,"B").Value < "" Then _
.value = .value & "-" & Cells(i, "B").Value
If Cells(i,"C").Value < "" Then _
.value = .value & "-" & Cells(i, "C").Value
End With
Next i

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Frank Kabel" wrote in message
...
Hi
you can use a formula like
=A1 & "-" & B1 & "-" & C1
and copy this down for all rows

--
Regards
Frank Kabel
Frankfurt, Germany


Rich wrote:
all, thanks for any response.

I would like to make a macro to take the contents of 3 columns of 20
numbers and letters, and combine them into one column to form a label
number.....this is relevant for a label making program that allows an
Excel import.

for example

A1 Port1 KVM

would turn into
A1-Port1-KVM

any help is appreciated.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro needed

Thank you for the effort Bob, but this returned a compile error

Rich


"Bob Phillips" wrote in message
...
If you need a macro

cRows = Cells(Rows.Count,"A").End(xlUp).Row
For i = 1 To cRows
With Cells(i,"A")
If Cells(i,"B").Value < "" Then _
.value = .value & "-" & Cells(i, "B").Value
If Cells(i,"C").Value < "" Then _
.value = .value & "-" & Cells(i, "C").Value
End With
Next i

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Frank Kabel" wrote in message
...
Hi
you can use a formula like
=A1 & "-" & B1 & "-" & C1
and copy this down for all rows

--
Regards
Frank Kabel
Frankfurt, Germany


Rich wrote:
all, thanks for any response.

I would like to make a macro to take the contents of 3 columns of 20
numbers and letters, and combine them into one column to form a label
number.....this is relevant for a label making program that allows an
Excel import.

for example

A1 Port1 KVM

would turn into
A1-Port1-KVM

any help is appreciated.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Macro needed

Hi
what compile error in whhich line did you get?

--
Regards
Frank Kabel
Frankfurt, Germany


Rich wrote:
Thank you for the effort Bob, but this returned a compile error

Rich


"Bob Phillips" wrote in message
...
If you need a macro

cRows = Cells(Rows.Count,"A").End(xlUp).Row
For i = 1 To cRows
With Cells(i,"A")
If Cells(i,"B").Value < "" Then _
.value = .value & "-" & Cells(i, "B").Value
If Cells(i,"C").Value < "" Then _
.value = .value & "-" & Cells(i, "C").Value
End With
Next i

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Frank Kabel" wrote in message
...
Hi
you can use a formula like
=A1 & "-" & B1 & "-" & C1
and copy this down for all rows

--
Regards
Frank Kabel
Frankfurt, Germany


Rich wrote:
all, thanks for any response.

I would like to make a macro to take the contents of 3 columns of
20 numbers and letters, and combine them into one column to form a
label number.....this is relevant for a label making program that
allows an Excel import.

for example

A1 Port1 KVM

would turn into
A1-Port1-KVM

any help is appreciated.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro needed

Sir,

it appeared in this line

rich


"Frank Kabel" wrote in message
...
Hi
what compile error in whhich line did you get?


cRows = Cells(Rows.Count,"A").End(xlUp).Row



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Macro needed

The only thing that occurs is if you have Option Explicit and have not
declared the variable cRows and i.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Rich" wrote in message
...
Thank you for the effort Bob, but this returned a compile error

Rich


"Bob Phillips" wrote in message
...
If you need a macro

cRows = Cells(Rows.Count,"A").End(xlUp).Row
For i = 1 To cRows
With Cells(i,"A")
If Cells(i,"B").Value < "" Then _
.value = .value & "-" & Cells(i, "B").Value
If Cells(i,"C").Value < "" Then _
.value = .value & "-" & Cells(i, "C").Value
End With
Next i

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Frank Kabel" wrote in message
...
Hi
you can use a formula like
=A1 & "-" & B1 & "-" & C1
and copy this down for all rows

--
Regards
Frank Kabel
Frankfurt, Germany


Rich wrote:
all, thanks for any response.

I would like to make a macro to take the contents of 3 columns of 20
numbers and letters, and combine them into one column to form a

label
number.....this is relevant for a label making program that allows

an
Excel import.

for example

A1 Port1 KVM

would turn into
A1-Port1-KVM

any help is appreciated.







  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Macro needed

Hi
have you tried Bob's suggestions (declaring the variables)?

--
Regards
Frank Kabel
Frankfurt, Germany


Rich wrote:
Sir,

it appeared in this line

rich


"Frank Kabel" wrote in message
...
Hi
what compile error in whhich line did you get?


cRows = Cells(Rows.Count,"A").End(xlUp).Row

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
Macro Help Needed Claireyscott Charts and Charting in Excel 1 July 31st 08 04:34 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Help needed on Macro Gary Excel Worksheet Functions 8 September 6th 06 10:33 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 01:03 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"