Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Help with script Please

Hi all, i got the code below and need some help to modify it to meet my
new requirements.
This code works great, i just need it to count if the range "AQ" is
either blank or "N", but cannot seem to get it right ??

Sub TotalNoPo()
'
Application.DisplayAlerts = False
Dim LastRowParts As Variant, LastRowSummary As Variant, NumberBlanks
As Variant
Dim RowCount As Long, PartID As Variant, C As Variant, SumRowCount
As Variant, PartRowCount As Variant
Dim Tdate As Date

Tdate = Date

With Sheets("ALL LC PARTS")
LastRowParts = .Cells(Rows.Count, "C").End(xlUp).Row
End With

With Sheets("0908 RMT")
LastRowSummary = .Cells(Rows.Count, "C").End(xlUp).Row
For SumRowCount = 20 To LastRowSummary
PartID = .Range("C" & SumRowCount)
If IsNumeric(PartID) Then
With Sheets("ALL LC PARTS")
NumberBlanks = 0
For PartRowCount = 1 To LastRowParts
If PartID = .Range("B" & PartRowCount) Then

*** I need here if "AQ" is empty or "N" it must count ****

If IsEmpty(.Cells(PartRowCount, "R")) And
IsEmpty(.Cells(PartRowCount, "L")) Then
NumberBlanks = NumberBlanks + 1
End If
End If
Next PartRowCount
End With
Else
With Sheets("ALL LC PARTS")
NumberBlanks = 0
For PartRowCount = 1 To LastRowParts
If PartID = .Range("L" & PartRowCount) Then
If IsEmpty(.Cells(PartRowCount, "R")) Then '--- No PO
NumberBlanks = NumberBlanks + 1
End If
End If
Next PartRowCount
End With
End If
.Range("J" & SumRowCount) = NumberBlanks


Next SumRowCount

MsgBox " DONE..."

End With

Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Help with script Please

If IsEmpty(.Cells(PartRowCount, "AQ").Value) Or _
.Cells(PartRowCount, "AQ").Value = "N") Then


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Les Stout" wrote in message
...
Hi all, i got the code below and need some help to modify it to meet my
new requirements.
This code works great, i just need it to count if the range "AQ" is
either blank or "N", but cannot seem to get it right ??

Sub TotalNoPo()
'
Application.DisplayAlerts = False
Dim LastRowParts As Variant, LastRowSummary As Variant, NumberBlanks
As Variant
Dim RowCount As Long, PartID As Variant, C As Variant, SumRowCount
As Variant, PartRowCount As Variant
Dim Tdate As Date

Tdate = Date

With Sheets("ALL LC PARTS")
LastRowParts = .Cells(Rows.Count, "C").End(xlUp).Row
End With

With Sheets("0908 RMT")
LastRowSummary = .Cells(Rows.Count, "C").End(xlUp).Row
For SumRowCount = 20 To LastRowSummary
PartID = .Range("C" & SumRowCount)
If IsNumeric(PartID) Then
With Sheets("ALL LC PARTS")
NumberBlanks = 0
For PartRowCount = 1 To LastRowParts
If PartID = .Range("B" & PartRowCount) Then

*** I need here if "AQ" is empty or "N" it must count ****

If IsEmpty(.Cells(PartRowCount, "R")) And
IsEmpty(.Cells(PartRowCount, "L")) Then
NumberBlanks = NumberBlanks + 1
End If
End If
Next PartRowCount
End With
Else
With Sheets("ALL LC PARTS")
NumberBlanks = 0
For PartRowCount = 1 To LastRowParts
If PartID = .Range("L" & PartRowCount) Then
If IsEmpty(.Cells(PartRowCount, "R")) Then '--- No PO
NumberBlanks = NumberBlanks + 1
End If
End If
Next PartRowCount
End With
End If
.Range("J" & SumRowCount) = NumberBlanks


Next SumRowCount

MsgBox " DONE..."

End With

Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Help with script Please

Thanks so much Bob.

Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
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
I need some VB script please rlee1999 Excel Discussion (Misc queries) 2 October 25th 06 05:46 PM
Can any help with a little script Danny Boy via OfficeKB.com Excel Programming 6 January 29th 06 11:47 AM
Script Help? couger77[_8_] Excel Programming 1 April 7th 04 01:47 AM
Excel 2000/XP script to Excel97 script hat Excel Programming 3 March 2nd 04 03:56 PM


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

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"