joining two rows

J

jena.ranjit

I am a novice in programming. Though I use MATCH function in excel
comfortably, I tried to write a code using MATCH function.
I have got two ranges, if I write =MATCH(400&1,dpcd&year,0) I get the
solution in excel. While puting the same in macro I find error at g
variable as" type mismatch". Please help me.


Sub Macro2()
Dim dp As Variant
Dim yr As Variant
Dim c As Variant
Dim g As Range
Dim e As Range
Dim f As Range
Dim L As Variant

'Dim d As Integer
dp = 1753
yr = 1
L = dp & yr
Set e = Worksheets(8).Range("dpcd")
Set f = Worksheets(8).Range("year")
Set g = Worksheets(8).Range("dpcd") & Worksheets(8).Range("year")
c = Application.Match(L, g, 0)

MsgBox " your row is " & c

End Sub
 

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