PDA

View Full Version : [SOLVED] Macro To Vlookup End Insert value



sal21
08-06-2004, 02:21 AM
perfect!

Jacob Hilderbrand
08-06-2004, 02:30 AM
Q of DETTAGLIO_CARICO is completely blank, is that correct?

Jacob Hilderbrand
08-06-2004, 02:31 AM
Ok try this:



Option Explicit
Sub CompareData()
Dim x As Long
Dim LastRow As Long
Dim c As Range
Dim CheckValue As Double
Application.ScreenUpdating = False
LastRow = Sheets("IMPAGATI").Range("D65536").End(xlUp).Row
For x = 3 To LastRow
CheckValue = Sheets("IMPAGATI").Range("D" & x).Value
With Sheets("DETTAGLIO_CARICO").Range("D:D")
Set c = .Find(What:=CheckValue, LookIn:=xlValues, LookAt:=xlWhole)
End With
If Not c Is Nothing Then
Sheets("IMPAGATI").Range("L" & x).Value = _
Sheets("DETTAGLIO_CARICO").Range("Q" & x).Value
End If
Application.StatusBar = "Calculating: " & x & " of " & _
LastRow & " < " & Format(x / LastRow, "Percent") & " > "
Next x
Application.StatusBar = False
Application.ScreenUpdating = True
End Sub

sal21
08-06-2004, 04:00 AM
But your macro delete the value in column L of IMPAGATI, i would wont ....

if the same number IN column D OF DETTAGLIO_CARICO is present IMPAGATI copy the relative value of the column L of IMPAGATI in column Q of DETTAGLIO_CARICO

Jacob Hilderbrand
08-06-2004, 04:05 AM
I dont really understand. Maybe you need to switch the line that changes the values. Try this:



Option Explicit
Sub CompareData()
Dim x As Long
Dim LastRow As Long
Dim c As Range
Dim CheckValue As Double
Application.ScreenUpdating = False
LastRow = Sheets("IMPAGATI").Range("D65536").End(xlUp).Row
For x = 3 To LastRow
CheckValue = Sheets("IMPAGATI").Range("D" & x).Value
With Sheets("DETTAGLIO_CARICO").Range("D:D")
Set c = .Find(What:=CheckValue, LookIn:=xlValues, LookAt:=xlWhole)
End With
If Not c Is Nothing Then
Sheets("DETTAGLIO_CARICO").Range("Q" & x).Value = _
Sheets("IMPAGATI").Range("L" & x).Value
End If
Application.StatusBar = "Calculating: " & x & " of " & _
LastRow & " < " & Format(x / LastRow, "Percent") & " > "
Next x
Application.StatusBar = False
Application.ScreenUpdating = True
End Sub

sal21
08-06-2004, 04:08 AM
BIG! Sorry for my english. It work naturally...

Jacob Hilderbrand
08-06-2004, 04:12 AM
No problem. So is this code working fine for you now or do we need to do something else?

sal21
08-06-2004, 04:21 AM
Nothing in this time many tks, tomorrow i go in vacation and you? If yor vacation time you go in Italy, to Napoli, tell me, i offer you a big pizza and a deliciuos caffe';-)

Jacob Hilderbrand
08-06-2004, 04:24 AM
Sounds good to me.

Take Care

sal21
08-30-2004, 03:59 AM
Sounds good to me.

Take Care
Hi, DRJ and All...
i am back to the vacation...
The first choice of this day it has been to one greet to you.

sal21
09-13-2004, 01:40 AM
http://www.erlandsendata.no/downloads/progressbarcontrol.zip

My dear i have dowloded this utility (i am interessed only for StartProcessing1) and i would want to integrate in your acript, have you a time for me?

My macro is located in modulo1

I have re-attache my initial wbook with your modify.
Tks

sal21
09-13-2004, 05:43 AM
No problem. So is this code working fine for you now or do we need to do something else?
if you heva a little time for me see my last post on this discussion...
Tks.
Sal