VBA quick change help

ryan_law2000

Well-known Member
Joined
Oct 2, 2007
Messages
738
everyone, I have VBA that works great except when a change is made in column G it runs the vlookup formula on all the rows in column H.
Any way to modify this so it only runs the vlookup on the updated row? and not the entire column?
thanks in advance...

Code:
If Not Intersect(Target, Sheet4.Range("G9:G1000")) Is Nothing Then
  Dim lRowCount As Long
  lRowCount = Cells(Rows.Count, "G").End(xlUp).Row
  
  With Range("H9").Resize(lRowCount)
    .Formula = "=IFERROR(VLOOKUP([@[Unit '#]],Table_owssvr_1[[#All],[Assigned Unit '#]:[Removal Date]],3),"""")": .Value = .Value
  End With
End If
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
I have tried this but I keep getting a "Compile Error: Invalid or unqualified reference"
Any ideas? (I have changed the ranges from original post)

Code:
If Not Intersect(Target, Sheet38.Range("A9:A110")) Is Nothing Then
If Target.Count > 1 Then Exit Sub

   Dim MyCells As Range
   Set MyCells = Range("A10:A110")
    
    If Not Application.Intersect(MyCells, Range(Target.Address)) _
           Is Nothing Then
       Target.Offset(, 1).Formula = "=IFERROR(VLOOKUP([@[Employee Name]],Table_powerviewsql_JobTracker_Employee[[Full Name]:[Position]],2,),"""")": .value = .value
    End If
End If
 
Upvote 0

Forum statistics

Threads
1,214,912
Messages
6,122,204
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top