Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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
Validating a resultant number against a number Pablo Fernandez Excel Worksheet Functions 2 August 13th 08 09:04 PM
Validating entries in Excel forms? SteW Excel Discussion (Misc queries) 2 March 1st 07 09:30 PM
Counting number of row entries BobD Excel Discussion (Misc queries) 1 June 21st 06 09:10 PM
Creating a certain number of entries based on a number in a cell PPV Excel Worksheet Functions 4 June 16th 05 10:25 PM
Validating a Number ID Ruan New Users to Excel 7 April 7th 05 02:36 AM


All times are GMT +1. The time now is 03:03 AM.

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"