F
fybar
I am looping through a range of cells and want to pass a the value to
another function as a string. Actually, it doesn't have to be a string,
I just am not sure how to pass it. I made test1 a string and then made
the value of test1 = the value of the cell then tried to pass as a string
but I get a ByReg argument type missmatch error. What concept am I
missing here?
Sub Looper()
Dim ColA As Range
Dim ColB As Range
Dim counter As Long
Dim rowNumber As Integer
Dim cellNumber As Integer
Dim test1, test2, test3 As String
Set ColA = Sheets("Puzzle").Range("A116")
Set ColB = Sheets("Puzzle").Range("R1:AH16")
For rowNumber = 1 To 16
'For rowNumber = 1654 To 4086
'Set ColA = Sheets("Puzzle").Range(Cells(rowNumber, 1), Cells
(rowNumber, 16))
For cellNumber = 1 To 16
test1 = ColA.Cells(rowNumber, cellNumber)
If test1 <> "" Then
'If ((Cells(rowNumber, 15).Value = "DI" Or Cells
(rowNumber, 15).Value = "DO") _
' And Cells(rowNumber, 23).Value <> "N/A") Then
' CreateDigitalDoc ColA, wordDocDigital
'ElseIf (Cells(rowNumber, 23).Value <> "N/A") Then
' CreateAnalogDoc ColA, wordDocAnalog
'End If
'Next cellNumber
ColB.Cells(rowNumber, cellNumber) = ColA.Cells
(rowNumber, cellNumber)
test2 = CStr(test1)
UpdateAll rowNumber, cellNumber, test2
End If
Next cellNumber
Next rowNumber
End Sub
Sub UpdateAll(rowNumber As Integer, cellNumber As Integer, test2 As
String)
'do some stuff here
End Sub
another function as a string. Actually, it doesn't have to be a string,
I just am not sure how to pass it. I made test1 a string and then made
the value of test1 = the value of the cell then tried to pass as a string
but I get a ByReg argument type missmatch error. What concept am I
missing here?
Sub Looper()
Dim ColA As Range
Dim ColB As Range
Dim counter As Long
Dim rowNumber As Integer
Dim cellNumber As Integer
Dim test1, test2, test3 As String
Set ColA = Sheets("Puzzle").Range("A116")
Set ColB = Sheets("Puzzle").Range("R1:AH16")
For rowNumber = 1 To 16
'For rowNumber = 1654 To 4086
'Set ColA = Sheets("Puzzle").Range(Cells(rowNumber, 1), Cells
(rowNumber, 16))
For cellNumber = 1 To 16
test1 = ColA.Cells(rowNumber, cellNumber)
If test1 <> "" Then
'If ((Cells(rowNumber, 15).Value = "DI" Or Cells
(rowNumber, 15).Value = "DO") _
' And Cells(rowNumber, 23).Value <> "N/A") Then
' CreateDigitalDoc ColA, wordDocDigital
'ElseIf (Cells(rowNumber, 23).Value <> "N/A") Then
' CreateAnalogDoc ColA, wordDocAnalog
'End If
'Next cellNumber
ColB.Cells(rowNumber, cellNumber) = ColA.Cells
(rowNumber, cellNumber)
test2 = CStr(test1)
UpdateAll rowNumber, cellNumber, test2
End If
Next cellNumber
Next rowNumber
End Sub
Sub UpdateAll(rowNumber As Integer, cellNumber As Integer, test2 As
String)
'do some stuff here
End Sub