I want to insert Text in Multiple Cells with the following Criteria using userform to input value
Sub AddSaturdaySunday()
' get the last row
Dim startRow As Long, lastRow As Long
startRow = 14
lastRow = Sheet1.Cells(Sheet1.Rows.Count, 1).End(xlUp).Row
Dim i As Long, Mydate As String
Dim sDate As String
' Go through the marks columns
For i = startRow To lastRow
Mydate = Sheet1.Range("B" & i).Value
' Check Mydate and classify accordingly then print Saturday and Sunday
If Mydate = "11" Then
sDate = "Saturday"
ElseIf Mydate = "12" Then
sDate = "Sunday"
Else
'For this part it must NOT REPLACE the value if the conditions above are not meet
End If
' Write out the Saturday and Sunday column C
Sheet1.Range("C" & i).Value = sDate
Next
End Sub
Bookmarks