Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
The following code works correctly, except that the vlookup function is consistently off by three rows. I get all of the correct data in column P and the data in column S and T is correct, but it all begins three rows than the data in column P. So the corresponding data at P4 is displayed in cells S7 and T7. What do I need to make it work correctly? Thanks. James Sub BlanksDumper() 'This sub deletes the blank rows on Sheet 1, column P and ' retrieves data using the individual's ID number Application.ScreenUpdating = False Dim DataRng As Range Dim r As Integer Dim LastCellRowNumber As Long Sheets("Sheet1").Select LastRow = Cells(Rows.Count, "P").End(xlUp).Row Set DataRng = Range("P4:P" & LastRow) For r = LastRow To 4 Step -1 If DataRng(r) = "" Then DataRng(r).EntireRow.Delete Else DataRng(r).Offset(0, 3).Value = "=VLOOKUP(K" & r & " , Beg_to_S1, 5, False)" DataRng(r).Offset(0, 4).Value = "=VLOOKUP(K" & r & " , Beg_to_S1, 4, False)" End If Next r Set DataRng = Nothing Application.ScreenUpdating = True LastCellRowNumber = Range("P" & Rows.Count).End(xlUp).Row End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Vlookup issue | Excel Discussion (Misc queries) | |||
VLOOKUP issue | Excel Worksheet Functions | |||
VLOOKUP issue | Excel Worksheet Functions | |||
VLOOKUP issue | Excel Worksheet Functions | |||
VLOOKUP Issue | Excel Programming |