Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / September 2006

Tip: Looking for answers? Try searching our database.

inserting special character in a cell as a macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
johnnyboy - 11 Sep 2006 18:18 GMT
I'm trying to copy 5600 items and I need to use a macro to save some time.
I have a column with numbers represented as text.  
For example 01234 as text. the cell adjacent to it is a city ie. Los Angeles
I'm trying to use a macro so the first cell is #01234 - Los Angeles.
Can someone help me to figure out this macro.
Don Guillett - 11 Sep 2006 18:56 GMT
=#01234&" - "&b2
or in b3

=b1&" - "&b2

Signature

Don Guillett
SalesAid Software
dguillett1@austin.rr.com

> I'm trying to copy 5600 items and I need to use a macro to save some time.
> I have a column with numbers represented as text.
> For example 01234 as text. the cell adjacent to it is a city ie. Los
> Angeles
> I'm trying to use a macro so the first cell is #01234 - Los Angeles.
> Can someone help me to figure out this macro.
CLR - 11 Sep 2006 19:12 GMT
Sub ConcatenateMe()
Dim lastrow As Long, r As Long
Dim num1 As String
Dim num2 As String
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
 For r = lastrow To 1 Step -1
    If Cells(r, "A") <> "" Then
       Cells(r, "A").Select
       num1 = Selection.Value
       num2 = Selection.Offset(0, 1).Value
    End If
    With ActiveCell
       .Value = "#" & num1 & " - " & num2
    End With
 Next r
End Sub

hth
Vaya con Dios,
Chuck, CABGx3

> I'm trying to copy 5600 items and I need to use a macro to save some time.
> I have a column with numbers represented as text.  
> For example 01234 as text. the cell adjacent to it is a city ie. Los Angeles
> I'm trying to use a macro so the first cell is #01234 - Los Angeles.
> Can someone help me to figure out this macro.
Gord Dibben - 11 Sep 2006 21:05 GMT
Here is a macro with choices.

Sub Add_Text()
Dim cell As Range
Dim moretext As String
Dim thisrng As Range
   On Error GoTo endit
   whichside = InputBox("Left = 1 or Right =2")
   Set thisrng = Range(ActiveCell.Address & "," & Selection.Address) _
           .SpecialCells(xlCellTypeConstants, xlTextValues)
   moretext = InputBox("Enter your Text")
   If whichside = 1 Then
       For Each cell In thisrng
           cell.Value = moretext & cell.Value
       Next
   Else
       For Each cell In thisrng
           cell.Value = cell.Value & moretext
       Next
   End If
   Exit Sub
endit:
   MsgBox "only numbers or formulas in range"
End Sub

Gord Dibben  MS Excel MVP

>I'm trying to copy 5600 items and I need to use a macro to save some time.
>I have a column with numbers represented as text.  
>For example 01234 as text. the cell adjacent to it is a city ie. Los Angeles
>I'm trying to use a macro so the first cell is #01234 - Los Angeles.
>Can someone help me to figure out this macro.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.