still looking for help with an If Then Vloop vba code.

G

GregJG

This is what I have so far;

If tb1.Value <> "" Then
Range("J15").Select
Do
If Ifempty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = 'here is where i run int
problems.

the activecell.value needs to be from a vlookup. this is what I a
trying, but not working

activecell.Value = Application.WorksheetFunction.VLookup(tb1.value
workbooks("Name").worksheets("Name").Range("a1:c200"), 3, 0)

The workbook that I am doing the Vlookup in, is open
 
J

JE McGimpsey

Sometimes VLookup doesn't play well with the WorksheetFunctions
collection.

Try:

Dim rCell As Range
If tb1.Value <> "" Then
With Range("J15")
If IsEmpty(.Value) Then
Set rCell = .Cells
ElseIf IsEmpty(.Offset(1, 0).Value) Then
Set rCell = .Offset(1, 0)
Else
Set rCell = .End(xlDown).Offset(1, 0)
End If
End With
rCell.Value = Application.VLookup(tb1.Value, _
Workbooks("Name.xls").Sheets("Name").Range("A1:C200"), 3, False)
End If
 

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