Hi,
Request guidance in the following areas-
I have the following code to stop loading user form if the selection is outside a data range. As I'm using the counta formula, it is stopping if the selection is in a blank cell even within the data range. I also tried If TypeName(Selection) = "Range" Then, but that is also not working
Secondly, I'm loading the column headers to a combobox. But if there is a heading on top of the column heading, then that heading gets added to the combobox. For example, if I have a column heading in cell "A1" in the attached file. I can offset the range by 1 row but how can I make it dynamic (heading may or may not be there)
Thanks in Advance!
Request guidance in the following areas-
I have the following code to stop loading user form if the selection is outside a data range. As I'm using the counta formula, it is stopping if the selection is in a blank cell even within the data range. I also tried If TypeName(Selection) = "Range" Then, but that is also not working
Code:
Public Sub ShowForm()
If WorksheetFunction.CountA(Selection) = 0 Then
MsgBox "Oops! Please select inside the data range.", vbInformation
Exit Sub
Else
Set rData = ActiveCell.CurrentRegion
End If
Load frmMain
frmMain.Show
End Sub
Secondly, I'm loading the column headers to a combobox. But if there is a heading on top of the column heading, then that heading gets added to the combobox. For example, if I have a column heading in cell "A1" in the attached file. I can offset the range by 1 row but how can I make it dynamic (heading may or may not be there)
Thanks in Advance!