Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel Message box, fields that are 0

Hi,

I would like to create a macro button that loops thru a column, if any
values on that column is greater than 0 then pop the message saying "pass
due" Thanks

Jimmy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Excel Message box, fields that are 0

Hi,

Right click your sheet tab, view code and paste this in and run it. You are
prompted for a column number to scan

Sub standard()
Dim MaxCol As Long, MyCol As Long, x As Long
MaxCols = ActiveSheet.Columns.Count
Do
MyCol = Val(InputBox("Enter column to scan"))
Loop Until MyCol <= MaxCols
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For x = 1 To lastrow
If Cells(x, MyCol).Value 0 Then
MsgBox "Pass Due in cell " & Cells(x, MyCol).Address
End If
Next
End Sub

Mike

"Jimjai" wrote:

Hi,

I would like to create a macro button that loops thru a column, if any
values on that column is greater than 0 then pop the message saying "pass
due" Thanks

Jimmy

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Excel Message box, fields that are 0

slight change in case there is text in the range

Sub standard()
Dim MaxCol As Long, MyCol As Long, x As Long
MaxCols = ActiveSheet.Columns.Count
Do
MyCol = Val(InputBox("Enter column to scan"))
Loop Until MyCol <= MaxCols
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For x = 1 To lastrow
If IsNumeric(Cells(x, MyCol).Value) And _
Cells(x, MyCol).Value 0 Then
MsgBox "Pass Due in cell " & Cells(x, MyCol).Address
End If
Next
End Sub

Mike

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste this in and run it. You are
prompted for a column number to scan

Sub standard()
Dim MaxCol As Long, MyCol As Long, x As Long
MaxCols = ActiveSheet.Columns.Count
Do
MyCol = Val(InputBox("Enter column to scan"))
Loop Until MyCol <= MaxCols
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For x = 1 To lastrow
If Cells(x, MyCol).Value 0 Then
MsgBox "Pass Due in cell " & Cells(x, MyCol).Address
End If
Next
End Sub

Mike

"Jimjai" wrote:

Hi,

I would like to create a macro button that loops thru a column, if any
values on that column is greater than 0 then pop the message saying "pass
due" Thanks

Jimmy

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel Message box, fields that are 0

Thanks for reply Miki,

I am getting "run-time error "1004": Application-defined or object-defined
error"

Jim


"Mike H" wrote:

slight change in case there is text in the range

Sub standard()
Dim MaxCol As Long, MyCol As Long, x As Long
MaxCols = ActiveSheet.Columns.Count
Do
MyCol = Val(InputBox("Enter column to scan"))
Loop Until MyCol <= MaxCols
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For x = 1 To lastrow
If IsNumeric(Cells(x, MyCol).Value) And _
Cells(x, MyCol).Value 0 Then
MsgBox "Pass Due in cell " & Cells(x, MyCol).Address
End If
Next
End Sub

Mike

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste this in and run it. You are
prompted for a column number to scan

Sub standard()
Dim MaxCol As Long, MyCol As Long, x As Long
MaxCols = ActiveSheet.Columns.Count
Do
MyCol = Val(InputBox("Enter column to scan"))
Loop Until MyCol <= MaxCols
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For x = 1 To lastrow
If Cells(x, MyCol).Value 0 Then
MsgBox "Pass Due in cell " & Cells(x, MyCol).Address
End If
Next
End Sub

Mike

"Jimjai" wrote:

Hi,

I would like to create a macro button that loops thru a column, if any
values on that column is greater than 0 then pop the message saying "pass
due" Thanks

Jimmy

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Excel Message box, fields that are 0

Hi,

From your mmessage header I guess your trying to copy the used range of each
sheet so try this

Sub group()
Dim i As Long
For i = 2 To Sheets.Count
lastrow = Worksheets("total").Cells(Rows.Count, "A").End(xlUp).Row
Worksheets(i).UsedRange.Copy _
Destination:=Worksheets("total").Cells(lastrow + 1, 1)
Next
End Sub

Mike

"Jimjai" wrote:

Hi,

I would like to create a macro button that loops thru a column, if any
values on that column is greater than 0 then pop the message saying "pass
due" Thanks

Jimmy



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Excel Message box, fields that are 0

Hi,

You must enter a column NUMBER on the input box not a letter. Column A=1 etc

Mike

"Jimjai" wrote:

Thanks for reply Miki,

I am getting "run-time error "1004": Application-defined or object-defined
error"

Jim


"Mike H" wrote:

slight change in case there is text in the range

Sub standard()
Dim MaxCol As Long, MyCol As Long, x As Long
MaxCols = ActiveSheet.Columns.Count
Do
MyCol = Val(InputBox("Enter column to scan"))
Loop Until MyCol <= MaxCols
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For x = 1 To lastrow
If IsNumeric(Cells(x, MyCol).Value) And _
Cells(x, MyCol).Value 0 Then
MsgBox "Pass Due in cell " & Cells(x, MyCol).Address
End If
Next
End Sub

Mike

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste this in and run it. You are
prompted for a column number to scan

Sub standard()
Dim MaxCol As Long, MyCol As Long, x As Long
MaxCols = ActiveSheet.Columns.Count
Do
MyCol = Val(InputBox("Enter column to scan"))
Loop Until MyCol <= MaxCols
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For x = 1 To lastrow
If Cells(x, MyCol).Value 0 Then
MsgBox "Pass Due in cell " & Cells(x, MyCol).Address
End If
Next
End Sub

Mike

"Jimjai" wrote:

Hi,

I would like to create a macro button that loops thru a column, if any
values on that column is greater than 0 then pop the message saying "pass
due" Thanks

Jimmy

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Excel Message box, fields that are 0

OOPS wrong thread

"Mike H" wrote:

Hi,

From your mmessage header I guess your trying to copy the used range of each
sheet so try this

Sub group()
Dim i As Long
For i = 2 To Sheets.Count
lastrow = Worksheets("total").Cells(Rows.Count, "A").End(xlUp).Row
Worksheets(i).UsedRange.Copy _
Destination:=Worksheets("total").Cells(lastrow + 1, 1)
Next
End Sub

Mike

"Jimjai" wrote:

Hi,

I would like to create a macro button that loops thru a column, if any
values on that column is greater than 0 then pop the message saying "pass
due" Thanks

Jimmy

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Excel Message box, fields that are 0

If you need only to determine whether there exists a value greater
than zero but do not need to get the actual location of that value,
use

Sub AAA()
Dim R As Range
With Worksheets("Sheet1")
Set R = Range(.Cells(1, "A"), _
.Cells(.Rows.Count, "A").End(xlUp))
End With
If Application.Sum(R.Value) 0 Then
MsgBox "Past Due"
End If
End Sub


If you do need to determine where the non-zero value occurs, use

Sub BBB()
Dim RR As Range
Dim R As Range
With Worksheets("Sheet1")
Set RR = Range(.Cells(1, "A"), _
.Cells(.Rows.Count, "A").End(xlUp))
End With
For Each R In RR.Cells
If IsNumeric(R.Value) Then
If R.Value 0 Then
Application.Goto R, True
MsgBox "Past Due"
Exit For
End If
End If
Next R
End Sub

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Wed, 18 Feb 2009 10:57:01 -0800, Jimjai
wrote:

Hi,

I would like to create a macro button that loops thru a column, if any
values on that column is greater than 0 then pop the message saying "pass
due" Thanks

Jimmy

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
fields names do not show in excel 2007 pivot table fields list marlo17 New Users to Excel 2 December 1st 08 01:25 PM
comparing 2 fields/cells and displaying a message programitcally question12 Excel Programming 1 January 29th 07 04:27 PM
Excel SHOULD NOT AUTO-CHANGE formated text fields to DATE FIELDS! PSSSD Excel Worksheet Functions 2 August 8th 06 09:31 PM
Replace Excel Message w/Custom Message Kevin R Excel Programming 1 May 18th 06 04:13 PM
Fix too few data fields error message when merging excel and word ARY Excel Discussion (Misc queries) 0 October 17th 05 08:51 PM


All times are GMT +1. The time now is 04:19 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"