Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Checking row for data

I have a worksheet with 16 columns and 54 rows.
Each row has a range D6 to S6, D7 to S7 ect.

I want to run a macro that checks each range to verify that only 6 columns
in each row have data entered.
I guess a dialog box or something to tell me which ranges have <6 or 6 in
them.

Thanks, much appreciated

CR


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Checking row for data

Something like this maybe?

Sub CheckForSixItems()
Dim RW As Long
Dim Items As Long
Dim Answer As String
' Change the 1 to 54 to your actual row range
For RW = 1 To 54
Items = WorksheetFunction.CountA(Range(Cells(RW, "D"), Cells(RW, "S")))
If Items < 6 Then
Answer = Answer & "Row " & RW & " < 6" & vbCrLf
ElseIf Items 6 Then
Answer = Answer & "Row " & RW & " 6" & vbCrLf
End If
Next
MsgBox Answer
End Sub

--
Rick (MVP - Excel)


"CR" wrote in message
m...
I have a worksheet with 16 columns and 54 rows.
Each row has a range D6 to S6, D7 to S7 ect.

I want to run a macro that checks each range to verify that only 6 columns
in each row have data entered.
I guess a dialog box or something to tell me which ranges have <6 or 6 in
them.

Thanks, much appreciated

CR


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Checking row for data

Outstanding, works like a charm

Thank you very much

CR



"Rick Rothstein" wrote in message
...
Something like this maybe?

Sub CheckForSixItems()
Dim RW As Long
Dim Items As Long
Dim Answer As String
' Change the 1 to 54 to your actual row range
For RW = 1 To 54
Items = WorksheetFunction.CountA(Range(Cells(RW, "D"), Cells(RW, "S")))
If Items < 6 Then
Answer = Answer & "Row " & RW & " < 6" & vbCrLf
ElseIf Items 6 Then
Answer = Answer & "Row " & RW & " 6" & vbCrLf
End If
Next
MsgBox Answer
End Sub

--
Rick (MVP - Excel)


"CR" wrote in message
m...
I have a worksheet with 16 columns and 54 rows.
Each row has a range D6 to S6, D7 to S7 ect.

I want to run a macro that checks each range to verify that only 6
columns in each row have data entered.
I guess a dialog box or something to tell me which ranges have <6 or 6
in them.

Thanks, much appreciated

CR




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Checking row for data

Is there a way to have the message box give the value of column C in each
range instead of the row number?

Thanks Again

CR


"CR" wrote in message
m...
Outstanding, works like a charm

Thank you very much

CR



"Rick Rothstein" wrote in message
...
Something like this maybe?

Sub CheckForSixItems()
Dim RW As Long
Dim Items As Long
Dim Answer As String
' Change the 1 to 54 to your actual row range
For RW = 1 To 54
Items = WorksheetFunction.CountA(Range(Cells(RW, "D"), Cells(RW,
"S")))
If Items < 6 Then
Answer = Answer & "Row " & RW & " < 6" & vbCrLf
ElseIf Items 6 Then
Answer = Answer & "Row " & RW & " 6" & vbCrLf
End If
Next
MsgBox Answer
End Sub

--
Rick (MVP - Excel)


"CR" wrote in message
m...
I have a worksheet with 16 columns and 54 rows.
Each row has a range D6 to S6, D7 to S7 ect.

I want to run a macro that checks each range to verify that only 6
columns in each row have data entered.
I guess a dialog box or something to tell me which ranges have <6 or 6
in them.

Thanks, much appreciated

CR






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Checking row for data

Here is one possible way...

Sub CheckForSixItems()
Dim RW As Long
Dim Items As Long
Dim Answer As String
' Change the 1 to 54 to your actual row range
For RW = 1 To 54
Items = WorksheetFunction.CountA(Range(Cells(RW, "D"), Cells(RW, "S")))
If Items < 6 Then
Answer = Answer & "Row " & RW & ": " & Cells(RW, "C").Value & _
" (Count < 6)" & vbCrLf
ElseIf Items 6 Then
Answer = Answer & "Row " & RW & ": " & Cells(RW, "D").Value & _
" (Count 6)" & vbCrLf
End If
Next
MsgBox Answer
End Sub

--
Rick (MVP - Excel)


"CR" wrote in message
m...
Is there a way to have the message box give the value of column C in each
range instead of the row number?

Thanks Again

CR


"CR" wrote in message
m...
Outstanding, works like a charm

Thank you very much

CR



"Rick Rothstein" wrote in message
...
Something like this maybe?

Sub CheckForSixItems()
Dim RW As Long
Dim Items As Long
Dim Answer As String
' Change the 1 to 54 to your actual row range
For RW = 1 To 54
Items = WorksheetFunction.CountA(Range(Cells(RW, "D"), Cells(RW,
"S")))
If Items < 6 Then
Answer = Answer & "Row " & RW & " < 6" & vbCrLf
ElseIf Items 6 Then
Answer = Answer & "Row " & RW & " 6" & vbCrLf
End If
Next
MsgBox Answer
End Sub

--
Rick (MVP - Excel)


"CR" wrote in message
m...
I have a worksheet with 16 columns and 54 rows.
Each row has a range D6 to S6, D7 to S7 ect.

I want to run a macro that checks each range to verify that only 6
columns in each row have data entered.
I guess a dialog box or something to tell me which ranges have <6 or 6
in them.

Thanks, much appreciated

CR









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Checking row for data

Thank you, I made that work!
You guys are amazing. I only try to do something like this every couple of
years and would have been frustrated for days trying to do what took you
minutes.

CR

"Rick Rothstein" wrote in message
...
Here is one possible way...

Sub CheckForSixItems()
Dim RW As Long
Dim Items As Long
Dim Answer As String
' Change the 1 to 54 to your actual row range
For RW = 1 To 54
Items = WorksheetFunction.CountA(Range(Cells(RW, "D"), Cells(RW, "S")))
If Items < 6 Then
Answer = Answer & "Row " & RW & ": " & Cells(RW, "C").Value & _
" (Count < 6)" & vbCrLf
ElseIf Items 6 Then
Answer = Answer & "Row " & RW & ": " & Cells(RW, "D").Value & _
" (Count 6)" & vbCrLf
End If
Next
MsgBox Answer
End Sub

--
Rick (MVP - Excel)


"CR" wrote in message
m...
Is there a way to have the message box give the value of column C in each
range instead of the row number?

Thanks Again

CR


"CR" wrote in message
m...
Outstanding, works like a charm

Thank you very much

CR



"Rick Rothstein" wrote in message
...
Something like this maybe?

Sub CheckForSixItems()
Dim RW As Long
Dim Items As Long
Dim Answer As String
' Change the 1 to 54 to your actual row range
For RW = 1 To 54
Items = WorksheetFunction.CountA(Range(Cells(RW, "D"), Cells(RW,
"S")))
If Items < 6 Then
Answer = Answer & "Row " & RW & " < 6" & vbCrLf
ElseIf Items 6 Then
Answer = Answer & "Row " & RW & " 6" & vbCrLf
End If
Next
MsgBox Answer
End Sub

--
Rick (MVP - Excel)


"CR" wrote in message
m...
I have a worksheet with 16 columns and 54 rows.
Each row has a range D6 to S6, D7 to S7 ect.

I want to run a macro that checks each range to verify that only 6
columns in each row have data entered.
I guess a dialog box or something to tell me which ranges have <6 or
6 in them.

Thanks, much appreciated

CR









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
Data checking- a better way! [email protected] Excel Programming 2 March 13th 08 11:03 AM
Checking entered data against exisitng data TonyR Excel Programming 1 May 31st 07 07:07 PM
Checking range of cells for entry then checking for total Barb Reinhardt Excel Programming 1 October 13th 06 02:47 PM
Please HELP: Checking data guy Excel Worksheet Functions 3 December 5th 05 02:51 AM
checking data Alex Excel Programming 1 August 10th 05 06:42 PM


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

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

About Us

"It's about Microsoft Excel"