Which info to change in my macro?

  • Thread starter Thread starter Souriane
  • Start date Start date
S

Souriane

HI!

I do not no much on programming macros.

Someone did this macro to me and it work fine. What it does is that it
ask me for my document number and then when I do "OK", it search the
document number in column "D" and once found it check the column "H"
with an "x".

Now, I would like to copy this same macro and have the column "F"
checked with a "r".

Can someone tell me wich part of the macro I must change? And explain
to me if I want column "S" or "P" or whatever column to be check, what
is the code to enter?
--------------

Also, I would like to had a line in the macro that, when I enter a
document number that does not exist in column "D", the macro write an
error message or a "Document Number not found".

THANK YOU VERY MUCH in advance to the help you can give me!!!

Souriane
Montréal, Québec
 
I forgot the macro! Here it is:

Sub BNCA()
Do
num = Val(InputBox("Entrez le numéro recherché", "Fenêtre de
recherche"))
If num = 0 Then Exit Sub
derlg = Range("d65536").End(3).Row
For i = 2 To derlg
If Cells(i, 4) = num Then
Cells(i, 8) = "x"
x = x + 1
End If
Next
If x = 0 Then MsgBox "Pas de numéro " & num & " dans la colonne D."
Loop
End Sub
 
replace this part:

If Cells(i, 4) = num Then
Cells(i, 8) = "x"
Cells(i,6) = "r"
x = x + 1
End If

the number in cells(i,8) tells it the column number. a is 1, b2 and so on
then i just added a condition to put the r in column f (6)
--


Gary


HI!

I do not no much on programming macros.

Someone did this macro to me and it work fine. What it does is that it
ask me for my document number and then when I do "OK", it search the
document number in column "D" and once found it check the column "H"
with an "x".

Now, I would like to copy this same macro and have the column "F"
checked with a "r".

Can someone tell me wich part of the macro I must change? And explain
to me if I want column "S" or "P" or whatever column to be check, what
is the code to enter?
--------------

Also, I would like to had a line in the macro that, when I enter a
document number that does not exist in column "D", the macro write an
error message or a "Document Number not found".

THANK YOU VERY MUCH in advance to the help you can give me!!!

Souriane
Montréal, Québec
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top