Macro for submitting data

John_Help_Me

New Member
Joined
May 15, 2006
Messages
17
All:

I have a macro button from a command button. The macro just autopopulates data for me into a sheet. How do I validate that data has been entered, meaning how does the macro know?

For example, in the data sheet, the user must enter in Name, Address and Phone number, in cells A1, A2, and A3, respectively. They then click the button and my other sheets gets populated with all three information.

How can I make it so that the user MUST enter all three data points?

Thanks in advance.
John
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
An example:

Code:
Sub Test()
    With Worksheets("Sheet1")
        If WorksheetFunction.CountA(Range("A1:A3")) <> 3 Then
            MsgBox "Data missing"
            Exit Sub
        Else
'           Your code
        End If
    End With
End Sub
 

Forum statistics

Threads
1,136,600
Messages
5,676,727
Members
419,647
Latest member
usas12gthr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top