PC Review


Reply
Thread Tools Rate Thread

check criteria and run macro

 
 
pswanie
Guest
Posts: n/a
 
      30th Dec 2007
thanx bob ur code works...

but now how do i change it to go and check on sheet named "inputpage" for
row a and b?

im going to put a cmdbutton on about 10 or 12 sheets and need this macro to
then go and check on the "inputpage" for that word/number combination

and where do i tell it to a macro called editsheet if the number enterd is
correct?



much appreciated






Sub Test()
Dim mpRow As Long
Dim mpWord As String
Dim mpResult As Double

mpRow = Int(Rnd() * 25 + 1)
mpWord = Cells(mpRow, "A").Value

On Error Resume Next
mpResult = InputBox("provide a number for " & mpWord)
On Error GoTo 0
If mpResult <> 0 Then

If mpResult <> Cells(mpRow, "B").Value Then

MsgBox "Wrong"
Else

Cells(mpRow, "A").Value = ""
End If
End If
End Sub


 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      30th Dec 2007
You can add a with statement and put a period infront of the cell references

Sub Test()
Dim mpRow As Long
Dim mpWord As String
Dim mpResult As Double


with sheets("inputpage")
mpRow = Int(Rnd() * 25 + 1)
mpWord = .Cells(mpRow, "A").Value

On Error Resume Next
mpResult = InputBox("provide a number for " & mpWord)
On Error GoTo 0
If mpResult <> 0 Then

If mpResult <> .Cells(mpRow, "B").Value Then

MsgBox "Wrong"
Else

.Cells(mpRow, "A").Value = ""
End If
End If
end with
End Sub


"pswanie" wrote:

> thanx bob ur code works...
>
> but now how do i change it to go and check on sheet named "inputpage" for
> row a and b?
>
> im going to put a cmdbutton on about 10 or 12 sheets and need this macro to
> then go and check on the "inputpage" for that word/number combination
>
> and where do i tell it to a macro called editsheet if the number enterd is
> correct?
>
>
>
> much appreciated
>
>
>
>
>
>
> Sub Test()
> Dim mpRow As Long
> Dim mpWord As String
> Dim mpResult As Double
>
> mpRow = Int(Rnd() * 25 + 1)
> mpWord = Cells(mpRow, "A").Value
>
> On Error Resume Next
> mpResult = InputBox("provide a number for " & mpWord)
> On Error GoTo 0
> If mpResult <> 0 Then
>
> If mpResult <> Cells(mpRow, "B").Value Then
>
> MsgBox "Wrong"
> Else
>
> Cells(mpRow, "A").Value = ""
> End If
> End If
> End Sub
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to check More than one criteria and get the value manju Microsoft Excel Worksheet Functions 1 28th Jan 2008 02:54 PM
Spell Check a protected Form with a Macro & already have forms picture macro slsjmc@yahoo.com Microsoft Word Document Management 2 25th Oct 2007 04:11 PM
check box criteria hugz via AccessMonster.com Microsoft Access Queries 1 29th May 2007 04:35 PM
Check Box Use As Criteria =?Utf-8?B?TmljayBoZnJ1cG4=?= Microsoft Access Queries 6 21st Nov 2005 07:56 AM
Criteria for Yes/No and Check Box Asa Kaplan Microsoft Access Queries 2 6th Apr 2004 01:32 PM


Features
 

Advertising
 

Newsgroups
 


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