Macro needed

  • Thread starter Thread starter Rich
  • Start date Start date
R

Rich

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
 
Hi
you can use a formula like
=A1 & "-" & B1 & "-" & C1
and copy this down for all rows
 
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)
 
Thank you for the effort Bob, but this returned a compile error

Rich
 
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)
 
Hi
have you tried Bob's suggestions (declaring the variables)?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Macro help needed 2
Need Macro... 8
need macro for fill down 1
Macro Help 7
Codes needed to update wages 8
Different Results from the Same Macro 2
Macro Help 2
excel macro help... please 7

Back
Top