noslenwerd
Board Regular
- Joined
- Nov 12, 2019
- Messages
- 85
- Office Version
- 365
The code below is throwing me a runtime 1004 error when I try to run the macro: Denoted with "'THIS IS WHERE THE ERROR OCCURS"
I suspect this is because I am using checkboxes in the "Deliverables" worksheet to start the For, and writing content to the "ReviewContent" worksheet after the If statement.
Any ideas?
When I replace the above with the code below, it runs fine (but will not work as I need to insert 'Text' into a series of columns
The questions is only posted here. Thank you for your help.
I suspect this is because I am using checkboxes in the "Deliverables" worksheet to start the For, and writing content to the "ReviewContent" worksheet after the If statement.
Any ideas?
VBA Code:
Sub acheckboxtext()
Dim Data() As Byte
Dim RevCol, RevRow As Long
Dim File As String
Dim Text As String
Dim cel As Range
RevCol = 27
RevRow = 3
For Each cel In Worksheets("Deliverables").Range("C10:C17")
If cel.Value = True Then
File = "C:\testing\worksheet\data\conversion\socialproof.txt"
Open File For Binary Access Read As #1
ReDim Data(LOF(1))
Get #1, , Data
Close #1
' // Convert bytes into a Unicode string.
Text = StrConv(Data, vbUnicode)
Worksheets("ReviewContent").Range(RevCol, RevRow) = Text 'THIS IS WHERE THE ERROR OCCURS
End If
RevCol = RevCol + 1
Next cel
End Sub
When I replace the above with the code below, it runs fine (but will not work as I need to insert 'Text' into a series of columns
VBA Code:
Worksheets("ReviewContent").Range("AA" & 3) = Text
The questions is only posted here. Thank you for your help.