LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
DDD DDD is offline
external usenet poster
 
Posts: 24
Default problem running code

Currently, i am running Excel 2007 at this moment.

This is exactly what i have done

I went to the the appropriate worksheet, went to the "Developer" tab &
clicked on "Visual Basic", in the blank window that appears i inserted the
following code (Thanks to Susan)


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("h8:h107")

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 & "has only 1 day left to return their book")
ElseIf c.Value = 2 Then
Set rMsg = WS.Range("a" & c.Row)
If MsgBox(" Date has passed for student with candidate #: " &
rMsg & " to return their book " & " 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


I saved it (clicked on picture of floppy disk), & closed down visual basic.

Back on excel i click on "Macro" in "Developer" tab & run the macro.

i made one of the cells in the q column display 1 or 2 but nothing happens


Did i do something wrong (i made sure macro use is enabled)

can any one help, im not experienced with using visual basic
 
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
Problem running VBA 2000 code in Excel 2003 Smurfette18 Excel Programming 3 December 14th 07 09:34 PM
Problem running Find code for different sheet excelnut1954 Excel Programming 3 February 24th 06 02:28 AM
Problem Running Code in Excel 2003 Mark Excel Programming 1 June 17th 05 12:45 AM
Problem running code behind a userform cdb Excel Programming 17 February 10th 05 03:53 PM
Problem with Running VBA code on Cell Change Marty Excel Programming 8 January 18th 05 04:01 AM


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