Hi guys,
Newbie here!
So I'm in the process of automating some tasks at work and am really new to VBA.
I have a VBA code that finds a column header and then selects the data underneath this header upto the last row.
From here I want to create an If statement to see whether the selection equals to zero. If it does, then I want to show a message box.
Newbie here!
So I'm in the process of automating some tasks at work and am really new to VBA.
I have a VBA code that finds a column header and then selects the data underneath this header upto the last row.
From here I want to create an If statement to see whether the selection equals to zero. If it does, then I want to show a message box.
Code:
Sub Checkblank()
Call IfBlank
Dim rng As Range
Set rng = Selection
If IsNull(rng) = True Then
MsgBox "No data for country selected"
End If
End Sub
Code:
Sub IfBlank()
Dim source As Range
Dim cl As Range
Dim Mnth As String
Mnth = InputBox("Enter Year & Month as MMM_YYYY")
Set source = Selection
With ActiveSheet.Cells
Set cl = .Find(Mnth, After:=.Range("A1"), LookIn:=xlValues, LookAt:=xlWhole)
If Not cl Is Nothing Then
cl.Select
End If
End With
ActiveCell.Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.SpecialCells(xlCellTypeVisible).Select
End Sub