Cant convert char string to integer for comparison.--Please Close Previous thread, not this one.
The code below did allow me to send the entered Pi data at Colum B. However the comparison to the digits on
[PiByPosition] row 3 that are integers and the routine places single char of the Pi string, for each value entered on row 5..
I have tried various CINT() but can't see to get it to convert properly, so I can't know if the entered value is correct or not.
========[This below request was resolved- but not the char to integer conversion]==========
Subroutine is supposed to enter the digits of Pi starting at Column B and so-forth for
1000 columns (digits I want to learn) .. if starting at 1 for 10 digits,
then fill the first 10 columns. If starting at 10th digit of Pi then start at the 10th column
and fill in 1-9 and 11-1000 with "" values in the cells. Excel file attached.
===========================================================================================
Sub Enter_Pi_into_PiByPosition()
'
'
'
Dim Counter, Counter2, StartNum, EndNum As Integer
Dim PiEnteredStr As String
Dim PiChar As String
Dim PiNumChar As Integer
'
Worksheets("Study_Area").Activate
Worksheets("PiByPosition").Activate
StartNum = Worksheets("Study_Area").Range("B5").Value
EndNum = Worksheets("Study_Area").Range("B6").Value
PiEnteredStr = Worksheets("Study_Area").Range("B18").Value
Counter2 = 1
For Counter = 2 To 1001
If Counter - 1 >= StartNum And Counter <= EndNum Then
If Counter2 <= EndNum Then
PiChar = Mid(PiEnteredStr, Counter2, 1)
PiCharNum = CInt(PiChar)
Worksheets("PiByPosition").Cells(5, Counter).Value = PiCharNum
Counter2 = Counter2 + 1
End If
Else
Worksheets("PiByPosition").Cells(5, Counter).Value = Null
End If
Next Counter
End Sub
Bookmarks