PDA

View Full Version : check and fill in the values to another sheet



sindhuja
07-09-2012, 08:11 PM
Hi,

I have two sheets names source.xlsx and master.xlsx.

1) i need to find whether values in source.xls in master.xlsx by using vlookup.

2) if found i need to find the values in master.xlsx and paste the values in column in which user has to specify. ex. if i want to paste the values in column named 15/06/2012 then i need to specify the value as 15/06/2012.

3) once the above process the done, then i need to check for the entries which are not available in the master file. Copy all the NA in source sheet and paste the same in master.xlsx after the last used cell in column A and fill the values as stated in step2.

Can this be done using macros. Kindly assist.

-Sindhuja

sindhuja
07-11-2012, 05:59 AM
Can i get assistance pls...

sindhuja
07-17-2012, 10:00 AM
can someone guide me please . .

sindhuja
07-19-2012, 05:09 AM
i have tried the below code but the out put was not as expected. i searched for the values in column A of source sheet in master sheet and the corresponding value to be entered in date column entered by the user.

eg.In the attached spreadsheet i have highlighted the entries that are found in master sheet and the other entries need to be entered into master sheet after the last used row and fill in the corresponding value.

The used should specify the date for which the data to be filled in.


Sub fsearch()
Dim wsDyn As Worksheet
Dim wsStat As Worksheet
Dim FirstAddress As String
Dim C As Range
Dim cel As Range
Dim i As Long

Set wsDyn = Worksheets("Master")
Set wsStat = Worksheets("Source")
For Each cel In wsDyn.Columns(1).SpecialCells(xlCellTypeConstants)
FirstAddress = ""
i = 0
With wsStat.Columns(1)
Set C = .Find(cel, LookIn:=xlValues, LookAt:=xlWhole, After:=.Cells(1000, 1))
If Not C Is Nothing Then
FirstAddress = C.Address
Do
i = i + 1
Dim r As Range
Dim CC As Range
Dim s As String
Dim ms As String
Set r = Range("A:X", Range("A65536").End(xlUp))
'ms = "The Value was found at "
s = InputBox("Enter the reporting date", "Enter date in the format mm/dd/yyyy")
For Each CC In r.Cells
If CC = s Then MsgBox ms & CC.Address
Next CC

cel.Offset(, i) = C.Offset(, CC.Address)
Set C = .FindNext(C)

Loop While Not C Is Nothing And C.Address <> FirstAddress
End If
End With
Next

End Sub



Am not sure how to link the codes so as to enter the values in the corresponding field. Any help on this will be highly appreciated.

-Sindhuja

sindhuja
07-23-2012, 10:14 PM
:help:help:help