VBA how to find the Cell needed

Joined
Feb 6, 2013
Messages
2
Reaction score
0
I have a question for VBA users.
I use an Excel sheet with a column stating multiple names and I use a row with names of months.

Now I need a way to find the cell that is corresponding with name and a known month.
So i have a var1= name ( for example Jet vervuild ) var2=month (FEB) and var3=number (2)

I wish to paste the number in the right cell..in this example J11...
Puzzels me sofar how to combine these all in a simple script.

HELP NEEDED thanks
 

Attachments

  • Werkmap1.xls.zip
    10.2 KB · Views: 132
Last edited:
Joined
Oct 23, 2012
Messages
29
Reaction score
0
i can't uderstand where did u get that with the name Jet vervuild comes Feb as month and 2 as number???
how did you arrange them this way,,
sorry for replaying late, but if you can explain i can help you with this
 
Joined
May 1, 2013
Messages
22
Reaction score
0
Harrij,

I assume that you are either passing in your variables or using user input, if not this will not help (sorry, I am not able to review your attachment right now). You can use the .find method to get the row number with the correct name (see example below) and I recommend either using constants for your months (as the column number) OR simply passing in a number instead of the month name. The example below assumes that you are passing in a number for the month/column value.

Code:
With ActiveWorkbook.Columns(1)
    set myRow = .Find(What:=var1, After:=ActiveCell,   LookIn:=xlFormulas, LookAt _
        :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
        False, SearchFormat:=False).Row
End With
 
ActiveSheet.Cells(myRow, var2).Value = var3

Please let me know if you have any questions or if this does not resolve your problem!
 

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

Top