Column Character

  • Thread starter Thread starter Bin
  • Start date Start date
B

Bin

An very basic question.
How to get a cell's column character, but not column
number? I mean for cells(1,1), I want to get a string
as "A", but not an integer 1.
The reason for that is when I work on Chart, it looks
dosen't accept
..SeriesCollection(1).XValues = Sheets("Sum").Range(cells
(2,1), cells(13,1))
only accept
..SeriesCollection(1).XValues = Sheets("Sum").Range
("A2:A13")
I need to convert cells to a "A2" format.
Thanks.
 
Sub test()
MsgBox ColLetters(Cells(1, 1))
MsgBox ColLetters(Cells(1, 27))
End Sub

Function ColLetters(There As Range) As String
ColLetters = Mid$(There.Address, 2)
ColLetters = Left$(ColLetters, InStr(ColLetters, "$") - 1)
End Function
 
this worked fine for me -

Sub Macro2()
Charts.Add
ActiveChart.ChartType = xlLineMarkers
With Sheets("sum")
ActiveChart.SetSourceData _
Source:=.Range(.Cells(2, 1), .Cells(13, 1)), _
PlotBy:=xlColumns
End With
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sum"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With

End Sub
 
Back
Top