Okay so below is the code. Basically what happens is that the compiler throws an "end if without block if" error and when I add an end if where required, it throws a "block if without end if" error - so what am I missing in the code then?
Code:
Private Sub UpdateCommentPic(ByVal Rowno As Integer, ByVal column As String, ByVal piclocation As String) Set MyImg = LoadPicture(piclocation)
Dim H As Long
Dim W As Long
H = MyImg.Height
W = MyImg.Width
Dim RowNumber As String
RowNumber = row
Dim cell As String
cell = column & RowNumber
Dim c As Comment
With Range(cell)
On Error Resume Next
Set c = .Comment
On Error GoTo 0
If c Is Nothing Then
Dim commentBox As Comment
Set commentBox = Sheet1.Range(cell).AddComment
With commentBox
.text text:=""
With .Shape
.Fill.UserPicture (piclocation)
.Height = H / 27
.Width = W / 27
End With
If piclocation = ActiveWorkbook.Path & "\Main Pics\No Photo.jpg" Then
Sheet1.Range(cell).Comment.Delete
Else
Sheet1.Range(cell).Comment.Delete
Dim commentBoxtwo As Comment
Set commentBoxtwo = Sheet1.Range(cell).AddComment
With commentBoxtwo
.text text:=""
With .Shape
.Fill.UserPicture (piclocation)
.Height = H / 27
.Width = W / 27
End With
End If
End If
End With
End Sub