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

Last edited:
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
 
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!
 
Back
Top