Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Validating number of entries
I am currently trying to get a marco to recongise when 86 Rows have bee written in an Excel workbook. I have currently created a Macro t insert a new row and copy the validation to the cells in the new row But I am having problems getting the If statement to work properly a it keeps displaying a messagebox no matter how many cells have bee entered, even if they are under 86. Please Help. Sub AddNewHouse() ' ' AddNewHouse Macro ' Adds New House to the table ' ' Rows("2:2").Select Selection.Insert Shift:=xlDown Range("A3:K3").Select Selection.AutoFill Destination:=Range("A2:K3") Type:=xlFillDefault Range("A2:K3").Select Range("A2:K2").Select Selection.ClearContents Range("J3").Select Selection.AutoFill Destination:=Range("J2:J3") Type:=xlFillDefault Range("J2:J3").Select Range("A2").Select 'Makes sure no more then 84 houses can be entred If Rows("86:86").Text = "" Then MsgBox "No more Records can be inserted here!" End If End Su ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com ~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Validating number of entries
If Rows("86:86").Text = "" Then
MsgBox "No more Records can be inserted here!" End If could be if Application.CountA(Rows("86:86")) 0 then MsgBox "No more Records can be inserted here!" End If -- Regards, Tom Ogilvy "NeilB" wrote in message ... I am currently trying to get a marco to recongise when 86 Rows have been written in an Excel workbook. I have currently created a Macro to insert a new row and copy the validation to the cells in the new row, But I am having problems getting the If statement to work properly as it keeps displaying a messagebox no matter how many cells have been entered, even if they are under 86. Please Help. Sub AddNewHouse() ' ' AddNewHouse Macro ' Adds New House to the table ' ' Rows("2:2").Select Selection.Insert Shift:=xlDown Range("A3:K3").Select Selection.AutoFill Destination:=Range("A2:K3"), Type:=xlFillDefault Range("A2:K3").Select Range("A2:K2").Select Selection.ClearContents Range("J3").Select Selection.AutoFill Destination:=Range("J2:J3"), Type:=xlFillDefault Range("J2:J3").Select Range("A2").Select 'Makes sure no more then 84 houses can be entred If Rows("86:86").Text = "" Then MsgBox "No more Records can be inserted here!" End If End Sub ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ ~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Validating a resultant number against a number | Excel Worksheet Functions | |||
Validating entries in Excel forms? | Excel Discussion (Misc queries) | |||
Counting number of row entries | Excel Discussion (Misc queries) | |||
Creating a certain number of entries based on a number in a cell | Excel Worksheet Functions | |||
Validating a Number ID | New Users to Excel |