#1   Report Post  
Posted to microsoft.public.excel.programming
DDD DDD is offline
external usenet poster
 
Posts: 24
Default Message box

I have an excel system that is used on excel 2007 & 2003. im just saying this
if it is important in some way

In the Q column i have a formula, in short displays 1 or 2 or nothing (As in
"") when certain circumstances are met.

I want to have a message box that displays when a number appears (1 or 2)


If 1 appears, i want the message to display the contents of the cell in the
same row in the A column, & state message
"tttttttttttttttttttttttttttttttttttttttttttt" .


If 2 appears i want the message to display the contents of the cell in the
same row in the A column & ask to delete the record with options yes or no to
click on.
If No is clicked, nothing happens. If yes is clicked i wanted the contents
of certain cells to be cleared (Cells on the same row in coLumns C, E, & G )



Sorry if this is not clear, if you have any questions please ask.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Message box

ok, i'm going to use a small range of q1:q10, for these purposes
only. you will have to change the range to suit what you need. also,
i'm not familiar with 2007; i assume this code will work on 2007 but
don't know that for sure. Compiled but not tested - save a copy of
your workbook before running the code:

Option Explicit

Sub DDD()

Dim Qrange As Range
Dim c As Range
Dim WS As Worksheet
Dim rMsg As Range

Set WS = ActiveWorkbook.ActiveSheet
Set Qrange = WS.Range("q1:q10")

For Each c In Qrange
If c.Value = "" Then
'do nothing
ElseIf c.Value = 1 Then
Set rMsg = WS.Range("a" & c.Row)
MsgBox (rMsg & " tttttttttttttttttttttttttttttttttt")
ElseIf c.Value = 2 Then
Set rMsg = WS.Range("a" & c.Row)
If MsgBox(rMsg & " Do you want to" _
& " delete this record?", vbYesNo _
, "Make a decision.") = vbYes Then
WS.Range("c" & c.Row).ClearContents
WS.Range("e" & c.Row).ClearContents
WS.Range("g" & c.Row).ClearContents
End If
End If
Next c

End Sub


hope it works!
:)
susan



On Jan 26, 9:43*am, DDD wrote:
I have an excel system that is used on excel 2007 & 2003. im just saying this
if it is important in some way

In the Q column i have a formula, in short displays 1 or 2 or nothing (As in
"") when certain circumstances are met.

I want to have a message box that displays when a number appears (1 or 2)

If 1 appears, i want the message to display the contents of the cell in the
same row in the A column, & state message
"tttttttttttttttttttttttttttttttttttttttttttt" .

If 2 appears i want the message to display the contents of the cell in the
same row in the A column & ask to delete the record with options yes or no to
click on.
If No is clicked, nothing happens. If yes is clicked i wanted the contents
of certain cells to be cleared (Cells on the same row in coLumns C, E, & G )

Sorry if this is not clear, if you have any questions please ask.


  #3   Report Post  
Posted to microsoft.public.excel.programming
DDD DDD is offline
external usenet poster
 
Posts: 24
Default Message box

Thank you it works.

Though, when i tested this, i had to run the macro manually when i made the
value "1" display in the cell (in the q column)

& had to run the macro manually again when when i changed "1" to "2"


is there any way i can run this macro automatically when the excel file is
opened & let it run continually, so that i dont have to repeat running the
macro over & over

"Susan" wrote:

ok, i'm going to use a small range of q1:q10, for these purposes
only. you will have to change the range to suit what you need. also,
i'm not familiar with 2007; i assume this code will work on 2007 but
don't know that for sure. Compiled but not tested - save a copy of
your workbook before running the code:

Option Explicit

Sub DDD()

Dim Qrange As Range
Dim c As Range
Dim WS As Worksheet
Dim rMsg As Range

Set WS = ActiveWorkbook.ActiveSheet
Set Qrange = WS.Range("q1:q10")

For Each c In Qrange
If c.Value = "" Then
'do nothing
ElseIf c.Value = 1 Then
Set rMsg = WS.Range("a" & c.Row)
MsgBox (rMsg & " tttttttttttttttttttttttttttttttttt")
ElseIf c.Value = 2 Then
Set rMsg = WS.Range("a" & c.Row)
If MsgBox(rMsg & " Do you want to" _
& " delete this record?", vbYesNo _
, "Make a decision.") = vbYes Then
WS.Range("c" & c.Row).ClearContents
WS.Range("e" & c.Row).ClearContents
WS.Range("g" & c.Row).ClearContents
End If
End If
Next c

End Sub


hope it works!
:)
susan



On Jan 26, 9:43 am, DDD wrote:
I have an excel system that is used on excel 2007 & 2003. im just saying this
if it is important in some way

In the Q column i have a formula, in short displays 1 or 2 or nothing (As in
"") when certain circumstances are met.

I want to have a message box that displays when a number appears (1 or 2)

If 1 appears, i want the message to display the contents of the cell in the
same row in the A column, & state message
"tttttttttttttttttttttttttttttttttttttttttttt" .

If 2 appears i want the message to display the contents of the cell in the
same row in the A column & ask to delete the record with options yes or no to
click on.
If No is clicked, nothing happens. If yes is clicked i wanted the contents
of certain cells to be cleared (Cells on the same row in coLumns C, E, & G )

Sorry if this is not clear, if you have any questions please ask.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Message box

yes, you could change it to a worksheet_change macro. this would have
to be put in the sheet module for the sheet you're working on:

right click on the sheet tab & choose "view code".

then add this:

Private Sub Worksheet_Change(ByVal Target As Range)

Dim Qrange As Range
Dim c As Range
Dim WS As Worksheet
Dim rMsg As Range


Set WS = ActiveWorkbook.ActiveSheet
Set Qrange = WS.Range("q1:q10")

If Target = Qrange Then
Application.EnableEvents = False

For Each c In Qrange
If c.Value = "" Then
'do nothing
ElseIf c.Value = 1 Then
Set rMsg = WS.Range("a" & c.Row)
MsgBox (rMsg & " tttttttttttttttttttttttttttttttttt")
ElseIf c.Value = 2 Then
Set rMsg = WS.Range("a" & c.Row)
If MsgBox(rMsg & " Do you want to" _
& " delete this record?", vbYesNo _
, "Make a decision.") = vbYes Then
WS.Range("c" & c.Row).ClearContents
WS.Range("e" & c.Row).ClearContents
WS.Range("g" & c.Row).ClearContents
End If
End If
Next c
End If

Application.EnableEvents = True

End Sub

hope that helps!
:)
susan



On Jan 26, 8:01*pm, DDD wrote:
Thank you it works.

Though, when i tested this, i had to run the macro manually when i made the
value "1" display in the cell (in the q column)

& had to run the macro manually again when when i changed "1" to "2"

is there any way i can run this macro automatically when the excel file is
opened & let it run continually, so that i dont have to repeat running the
macro over & over



"Susan" wrote:
ok, i'm going to use a small range of q1:q10, for these purposes
only. *you will have to change the range to suit what you need. *also,
i'm not familiar with 2007; i assume this code will work on 2007 but
don't know that for sure. *Compiled but not tested - save a copy of
your workbook before running the code:


Option Explicit


Sub DDD()


Dim Qrange As Range
Dim c As Range
Dim WS As Worksheet
Dim rMsg As Range


Set WS = ActiveWorkbook.ActiveSheet
Set Qrange = WS.Range("q1:q10")


For Each c In Qrange
* * *If c.Value = "" Then
* * * * * 'do nothing
* * *ElseIf c.Value = 1 Then
* * * * * Set rMsg = WS.Range("a" & c.Row)
* * * * * MsgBox (rMsg & " tttttttttttttttttttttttttttttttttt")
* * *ElseIf c.Value = 2 Then
* * * * * Set rMsg = WS.Range("a" & c.Row)
* * * * * * If MsgBox(rMsg & " Do you want to" _
* * * * * * * & " delete this record?", vbYesNo _
* * * * * * * , "Make a decision.") = vbYes Then
* * * * * * * * *WS.Range("c" & c.Row).ClearContents
* * * * * * * * *WS.Range("e" & c.Row).ClearContents
* * * * * * * * *WS.Range("g" & c.Row).ClearContents
* * * * * * *End If
* * * End If
Next c


End Sub


hope it works!
:)
susan


On Jan 26, 9:43 am, DDD wrote:
I have an excel system that is used on excel 2007 & 2003. im just saying this
if it is important in some way


In the Q column i have a formula, in short displays 1 or 2 or nothing (As in
"") when certain circumstances are met.


I want to have a message box that displays when a number appears (1 or 2)


If 1 appears, i want the message to display the contents of the cell in the
same row in the A column, & state message
"tttttttttttttttttttttttttttttttttttttttttttt" .


If 2 appears i want the message to display the contents of the cell in the
same row in the A column & ask to delete the record with options yes or no to
click on.
If No is clicked, nothing happens. If yes is clicked i wanted the contents
of certain cells to be cleared (Cells on the same row in coLumns C, E, & G )


Sorry if this is not clear, if you have any questions please ask.- Hide quoted text -


- Show quoted text -


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Message box

DDD,

Sub DeleteRows()
Dim myR As Long

For myR = Cells(Rows.Count, "Q").End(xlUp).Row To 2 Step -1
If Cells(myR, "Q").Value = 1 Then _
MsgBox Cells(myR, "A").Value & _
" tttttttttttttttttttttttttttttttt"

If Cells(myR, "Q").Value = 2 Then
If MsgBox(Cells(myR, "A").Value & _
" Do you want to delete this row?", vbYesNo) = vbYes Then
Cells(myR, "A").EntireRow.Delete
End If
End If
Next myR
End Sub

HTH,
Bernie
MS Excel MVP


"DDD" wrote in message
...
I have an excel system that is used on excel 2007 & 2003. im just saying this
if it is important in some way

In the Q column i have a formula, in short displays 1 or 2 or nothing (As in
"") when certain circumstances are met.

I want to have a message box that displays when a number appears (1 or 2)


If 1 appears, i want the message to display the contents of the cell in the
same row in the A column, & state message
"tttttttttttttttttttttttttttttttttttttttttttt" .


If 2 appears i want the message to display the contents of the cell in the
same row in the A column & ask to delete the record with options yes or no to
click on.
If No is clicked, nothing happens. If yes is clicked i wanted the contents
of certain cells to be cleared (Cells on the same row in coLumns C, E, & G )



Sorry if this is not clear, if you have any questions please ask.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Message box

Ooops, I read your question too quickly and came away with deleting the row... sorry - ignore it...

Bernie
MS Excel MVP


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
DDD,

Sub DeleteRows()
Dim myR As Long

For myR = Cells(Rows.Count, "Q").End(xlUp).Row To 2 Step -1
If Cells(myR, "Q").Value = 1 Then _
MsgBox Cells(myR, "A").Value & _
" tttttttttttttttttttttttttttttttt"

If Cells(myR, "Q").Value = 2 Then
If MsgBox(Cells(myR, "A").Value & _
" Do you want to delete this row?", vbYesNo) = vbYes Then
Cells(myR, "A").EntireRow.Delete
End If
End If
Next myR
End Sub

HTH,
Bernie
MS Excel MVP


"DDD" wrote in message
...
I have an excel system that is used on excel 2007 & 2003. im just saying this
if it is important in some way

In the Q column i have a formula, in short displays 1 or 2 or nothing (As in
"") when certain circumstances are met.

I want to have a message box that displays when a number appears (1 or 2)


If 1 appears, i want the message to display the contents of the cell in the
same row in the A column, & state message
"tttttttttttttttttttttttttttttttttttttttttttt" .


If 2 appears i want the message to display the contents of the cell in the
same row in the A column & ask to delete the record with options yes or no to
click on.
If No is clicked, nothing happens. If yes is clicked i wanted the contents
of certain cells to be cleared (Cells on the same row in coLumns C, E, & G )



Sorry if this is not clear, if you have any questions please ask.





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
replace VBA run-time error message with custom message BEEJAY Excel Programming 13 July 14th 06 03:59 PM
Replace Excel Message w/Custom Message Kevin R Excel Programming 1 May 18th 06 04:13 PM
Intercept/replace standard 'cell protected' message with my own message? KR Excel Programming 3 March 16th 06 02:31 PM
Opening an attachment of a message that has a message as attachmen vetron Excel Programming 0 January 30th 06 06:17 PM
Displaying a message in a message box without requiring user to click anything to proceed Android[_2_] Excel Programming 2 June 25th 04 06:44 PM


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