View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Living the Dream Living the Dream is offline
external usenet poster
 
Posts: 151
Default text to number graph

Hi

This will change your M's into 1's, and your I's into 2's.

Sub ChangeI()
Dim RowNum As Integer
RowNum = 2
Range("B2").Select
Do
Replacement = ActiveCell.Value
Range("B" & RowNum).Select
Selection.Replace What:="I", Replacement:=2, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
RowNum = RowNum + 1
Range("B" & RowNum).Select
Loop Until ActiveCell.Value = ""
End Sub

Sub ChangeM()
Dim RowNum As Integer
RowNum = 2
Range("B2").Select
Do
Replacement = ActiveCell.Value
Range("B" & RowNum).Select
Selection.Replace What:="M", Replacement:=1, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
RowNum = RowNum + 1
Range("B" & RowNum).Select
Loop Until ActiveCell.Value = ""
End Sub

.................................................. ...............


As for your Graph, I wasn't sure as to what style of vraoh your were
wanting, so I played around with a Pivot table that does the following:

Now, I have used 00.00 to represent blank cells as it give a better
alignment below.

A1 00.00 00.00 10.61 00.00 17.33 00.00 00.00 27.35
A2 00.00 00.00 00.00 00.00 00.00 00.00 00.00 00.00
B1 07.10 00.00 00.00 00.00 00.00 00.00 00.00 00.00
B2 00.00 00.00 00.00 00.00 00.00 00.00 00.00 00.00
C1 00.00 00.00 00.00 11.01 00.00 18.44 00.00 00.00
C2 00.00 00.00 00.00 00.00 00.00 00.00 22.72 00.00
D1 00.00 07.72 00.00 00.00 00.00 00.00 00.00 00.00
D2 00.00 00.00 00.00 00.00 00.00 00.00 00.00 00.00

If this is kin of what you are looking for, I have a Recorded Macro
below, which does the job and creates the above on a new sheet. One of
the other aptly qualified contributors may have a neater option for you.

HTH
Mick.

Sub PivotMyData()
Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDa tabase,
SourceData:= _
"Sheet1!R1C1:R22C2",
Version:=xlPivotTableVersion14).CreatePivotTable _
TableDestination:="Sheet6!R3C1", TableName:="PivotTable3",
DefaultVersion _
:=xlPivotTableVersion14
Sheets("Sheet6").Select
Cells(3, 1).Select
ActiveWorkbook.ShowPivotTableFieldList = True
With ActiveSheet.PivotTables("PivotTable3").PivotFields ("YourCode")
.Orientation = xlRowField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable3").AddDataFiel d
ActiveSheet.PivotTables( _
"PivotTable3").PivotFields("YourVal"), "Sum of YourVal", xlSum
With ActiveSheet.PivotTables("PivotTable3").PivotFields ("YourVal")
.Orientation = xlColumnField
.Position = 1
End With
Range("A1").Select
End Sub