Hello,
I keep getting a mismatch error, but i can't figure out why. Here is the code:
Sub Report()
Dim LR As Long
Dim LC As Long
Dim Rooms As Long
Dim ADR As Long
Dim Nights As Long
Dim r As Long
Dim c As Long
LR = Cells(Rows.Count, 1).End(xlUp).Row
LC = Cells(16, Columns.Count).End(xlToRight).Column
For r = 18 To LR
For c = 17 To LC
If Cells(r, c).Value = "Here" Then
Rooms = Cells(r, 14).Value
ADR = Cells(r, 16).Value
Nights = Cells(r, 12).Value
Range(Cells(r, c), Cells(r, (c + Nights))).Value = Rooms * ADR
End If
Next c
Next r
End Sub
When I try to run I get Run-time error '13': Type mismatch.
If I click debug, it highlights the row: If Cells(r,c).Value = "Here" Then
I have also tried using: If Cells(r,c).Value = 1 Then
And changed the formula in my worksheet to supply '1' instead of 'Here'.
I can't figure this out. It makes sense to me.
Thanks for any help.
Chris
I keep getting a mismatch error, but i can't figure out why. Here is the code:
Sub Report()
Dim LR As Long
Dim LC As Long
Dim Rooms As Long
Dim ADR As Long
Dim Nights As Long
Dim r As Long
Dim c As Long
LR = Cells(Rows.Count, 1).End(xlUp).Row
LC = Cells(16, Columns.Count).End(xlToRight).Column
For r = 18 To LR
For c = 17 To LC
If Cells(r, c).Value = "Here" Then
Rooms = Cells(r, 14).Value
ADR = Cells(r, 16).Value
Nights = Cells(r, 12).Value
Range(Cells(r, c), Cells(r, (c + Nights))).Value = Rooms * ADR
End If
Next c
Next r
End Sub
When I try to run I get Run-time error '13': Type mismatch.
If I click debug, it highlights the row: If Cells(r,c).Value = "Here" Then
I have also tried using: If Cells(r,c).Value = 1 Then
And changed the formula in my worksheet to supply '1' instead of 'Here'.
I can't figure this out. It makes sense to me.
Thanks for any help.
Chris