How do I reference the cell address next to Active cell

  • Thread starter Thread starter Nico Le Roux
  • Start date Start date
N

Nico Le Roux

My user choose something from the my combo box and the VBA code add the
value to the active cell.

I would like to lookup this value in another range and add the result of the
lookup to the right of the active cell.

Your help would be appreciated.

Regards
Nico
 
Hi
to reference the cell next to the active cell you may use
activecell.offset(0,1).value = your_lookup_value
 
Hi Nico,

In VBA?

Set oFound = Worksheets("Sheet2").Range("A1:A100).Find(Acivecell.Value)
If Not oFound Is Nothing Then
Activecell.Offset(0,1).Value = oFound.Offset(0,4).Value
End If

or alternatively

Activecell.Offset(0,1).Value =
WorksheetFunction.VLookup(Activecell.Value,Range("A1:F100,4,False)

Change the ,4 to the offset in the lookup range that you want in both
examples.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
activecell.offset(0,1).Value = ActiveCell.Value +
Application.Vlookup(activeCell.Value, _
Worksheets("Sheet2").Range("A1:A200"),2,False)
 
An alternative, probably faster, to ActiveCell.Offset(0,1) is
ActiveCell(1,2)

Alan Beban
 
Back
Top