G
GL Fr
Within a couple of embedded loops I am trying to extract a comment , process
the comment, and place a value in a separate sheet . I get the following
error
'Run time error 1004'
'Application-defined or object defined error'
Please help
code is below
Sub establish_onoffattr()
Dim i, p As Integer
p = 1
Do While Worksheets("HC").Cells(p, 1) <> ""
For i = 1 To 43
Call range_calc(Srange, (p), (i))
' df = Worksheets("HC").Range(Srange).Comment.Text
'assign cell value to a string variable
With Worksheets("HC").Range(Srange).Select ' ERROR OCCURS HERE
'Srange = "A1"
Dim tst As String
tst = ActiveCell.Value
' Further manipulatinos to occur here
End With
Next i
p = p + 1
Loop
Sub range_calc(Astr, row As Integer, col As Long)
'Dim row, col As Integer
Dim l As Long
Dim alpha
FS = col \ 26
SRemainder1 = col Mod 26
If FS = 0 Then
sx = Chr(64 + SRemainder1)
Else
sx = Chr(64 + FS) + Chr(64 + SRemainder1)
End If
l = col
alpha = str(l)
Astr = sx + Mid(str(row), 2)
End Sub
the comment, and place a value in a separate sheet . I get the following
error
'Run time error 1004'
'Application-defined or object defined error'
Please help
code is below
Sub establish_onoffattr()
Dim i, p As Integer
p = 1
Do While Worksheets("HC").Cells(p, 1) <> ""
For i = 1 To 43
Call range_calc(Srange, (p), (i))
' df = Worksheets("HC").Range(Srange).Comment.Text
'assign cell value to a string variable
With Worksheets("HC").Range(Srange).Select ' ERROR OCCURS HERE
'Srange = "A1"
Dim tst As String
tst = ActiveCell.Value
' Further manipulatinos to occur here
End With
Next i
p = p + 1
Loop
Sub range_calc(Astr, row As Integer, col As Long)
'Dim row, col As Integer
Dim l As Long
Dim alpha
FS = col \ 26
SRemainder1 = col Mod 26
If FS = 0 Then
sx = Chr(64 + SRemainder1)
Else
sx = Chr(64 + FS) + Chr(64 + SRemainder1)
End If
l = col
alpha = str(l)
Astr = sx + Mid(str(row), 2)
End Sub