Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run Macro Only If 4 Cells Are Filled In By User In VBA


Thanks Norman.

I have made a few user specific adjustments:

Private Sub CommandButton1_Click()
Dim rng As Range

Set rng = Range("E6, E8,E10,E12")

If Application.CountA(rng) < 4 Then
MsgBox "Please Complete At Least The Following" & Chr(13) & "Custome
Name." & Chr(13) & "Customer Number." & Chr(13) & "Credit Limit."
Chr(13) & "Current Balance.", vbInformation, "IMPORTANT!"
Exit Sub

Else
Sheets("Lock2").Select
Application.StatusBar = "Please Enter The Details Requested The
Press The Next Button"
ActiveWindow.DisplayVerticalScrollBar = False

End If

End Sub

And this now works an absolute treat.

Thanks for all your help with this question and all the others I hav
posted that you have been very kind to help me on. Big Help.

Thanks again.

Celtic_Avenger
:) :) :) :) :

--
Celtic_Avenge
-----------------------------------------------------------------------
Celtic_Avenger's Profile: http://www.excelforum.com/member.php...fo&userid=1410
View this thread: http://www.excelforum.com/showthread.php?threadid=26137

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Run Macro Only If 4 Cells Are Filled In By User In VBA

I'd change this:

If Application.CountA(rng) < 4 Then
to
If Application.CountA(rng) < rng.cells.count then

Then if you increase/decrease the cells in rng, you don't have to worry about
finding all the 4's and adjusting them.

Celtic_Avenger wrote:

Thanks Norman.

I have made a few user specific adjustments:

Private Sub CommandButton1_Click()
Dim rng As Range

Set rng = Range("E6, E8,E10,E12")

If Application.CountA(rng) < 4 Then
MsgBox "Please Complete At Least The Following" & Chr(13) & "Customer
Name." & Chr(13) & "Customer Number." & Chr(13) & "Credit Limit." &
Chr(13) & "Current Balance.", vbInformation, "IMPORTANT!"
Exit Sub

Else
Sheets("Lock2").Select
Application.StatusBar = "Please Enter The Details Requested Then
Press The Next Button"
ActiveWindow.DisplayVerticalScrollBar = False

End If

End Sub

And this now works an absolute treat.

Thanks for all your help with this question and all the others I have
posted that you have been very kind to help me on. Big Help.

Thanks again.

Celtic_Avenger
:) :) :) :) :)

--
Celtic_Avenger
------------------------------------------------------------------------
Celtic_Avenger's Profile: http://www.excelforum.com/member.php...o&userid=14101
View this thread: http://www.excelforum.com/showthread...hreadid=261374


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop user from saving workbook unless cell is filled in Churley Excel Discussion (Misc queries) 3 October 16th 08 04:44 PM
Filled cells dont appear as filled SMILLS Excel Discussion (Misc queries) 6 October 18th 07 05:28 PM
Macro Request: Fill in empty cells with previous Filled cell in column Artis Excel Worksheet Functions 2 June 25th 07 08:30 PM
Macro that copy page to page just some filled cells LC Excel Discussion (Misc queries) 0 May 13th 05 11:22 PM
Run Macro Only If 4 Cells Are Filled In By User In VBA Celtic_Avenger[_43_] Excel Programming 1 September 19th 04 11:27 AM


All times are GMT +1. The time now is 12:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"