Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1
Default inserting special character in a cell as a macro

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.

  #3   Report Post  
Posted to microsoft.public.excel.newusers
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default inserting special character in a cell as a macro

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



"johnnyboy" wrote:

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.


  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 22,906
Default inserting special character in a cell as a macro

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

On Mon, 11 Sep 2006 17:18:28 GMT, "johnnyboy" <u26492@uwe wrote:

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.


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
error when running cut & paste macro Otto Moehrbach Excel Worksheet Functions 4 August 9th 06 01:49 PM
Inserting a button into a cell and linking it to a macro Robb W Excel Discussion (Misc queries) 3 May 2nd 06 09:04 PM
Conditional Format as a MACRO Gunjani Excel Worksheet Functions 3 March 29th 06 05:22 PM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 04:38 PM.

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"