Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to take data out of column A and put that with all commas but i
need to add the following symbol ', example 11111 11112 11113 11114 I need to create a macro that takes this column and create it as follows 11111,11112,11113,11114 but i need the symbol added so that it looks as follows: '11111','11112','11113','11114' *** Sent via Developersdex http://www.developersdex.com *** |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub test()
Dim colA As Range, cA As Range Set colA = Range("A1:A4") result = "'" For Each cA In colA result = result & cA & "','" Next cA result = Left(result, Len(result) - 2) Range("B1").Value = result End Sub Adjust Range("A1:A4")! It puts the result in B1! Regards, Stefi €˛Lynette Olivier€¯ ezt Ć*rta: I need to take data out of column A and put that with all commas but i need to add the following symbol ', example 11111 11112 11113 11114 I need to create a macro that takes this column and create it as follows 11111,11112,11113,11114 but i need the symbol added so that it looks as follows: '11111','11112','11113','11114' *** Sent via Developersdex http://www.developersdex.com *** |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Another one, adapt to your needs -
Sub test() Dim nRows As Long, nCols As Long Dim s As String, sMsg As String Dim rng As Range Dim arr Set rng = Range("A1:A4") ' < change, eg set rng=Selection With rng nRows = .Rows.Count nCols = .Columns.Count arr = .Value End With If nRows 1 And nCols 1 Then sMsg = "Only select cells in a single row or column" ElseIf nRows = 1 And nCols = 1 Then sMsg = "Only one cell selected" ElseIf nRows 256 Then sMsg = "too many cells selected" ElseIf nCols = 1 Then arr = Application.Transpose(arr) End If If Len(sMsg) Then MsgBox sMsg Else s = Join(arr, ",") If IsNumeric(s) Then s = "'" & s Range("B1") = s End If End Sub Regards, Peter T "Lynette Olivier" wrote in message ... I need to take data out of column A and put that with all commas but i need to add the following symbol ', example 11111 11112 11113 11114 I need to create a macro that takes this column and create it as follows 11111,11112,11113,11114 but i need the symbol added so that it looks as follows: '11111','11112','11113','11114' *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Symbols on the keyboard are not the symbols on the screen.... | Excel Discussion (Misc queries) | |||
How to insert maths symbols into an excell function? | Excel Worksheet Functions | |||
How do you insert wingdings symbols using VBA macro? | Excel Programming | |||
Inserting Symbols via a macro | Excel Programming | |||
converting Lotus 123 macro to Excell macro | Excel Discussion (Misc queries) |