I am trying to build a sub to check if a workbook is opened by calling a function
and tell if the workbook on the next cell
but if the user doesnt enter a bookname, "Please enter a bookname"t would just show on the next cell
The thing is i wanna change color of "please enter a bookname" into red and turn the message into bold
so what should i do in the code ?
and tell if the workbook on the next cell
but if the user doesnt enter a bookname, "Please enter a bookname"t would just show on the next cell
The thing is i wanna change color of "please enter a bookname" into red and turn the message into bold
so what should i do in the code ?
Code:
Sub ChecktheworkbookOpen()
Dim IsOpen As Boolean
Dim BookName As String
Dim i As Integer
For i = 1 To 10
If Cells(i, 2) = "" Then
Cells(i, 2).Offset(, 1) = "Please enter a bookname"
Else
BookName = Cells(i, 2).Value
IsOpen = Check_workbook_open(BookName)
If IsOpen = True Then
Cells(i, 2).Offset(, 1) = "Opened"
Else
Cells(i, 2).Offset(, 1) = "Not yet opened"
End If
End If
Next