I want to send data from one workbook to another workbook (workbook A sends data to workbook B).
I made a code that opens workbook B and searches for values which are given in certain cells in workbook A.
The only thing that I can't make and need help with is to copy a range from workbook A (Range: G71 up to and including DI71) and paste this range in workbook B at the column and row that is found with this code
The code that I have up to now:
Private Sub CommandButton1_Click()
Dim Fstring As String
Dim Pstring As String
Dim Bureauplanning As String
Dim wb As Workbook
Dim cFind As Range
Dim rFind As Range
Dim rngc As Range
Dim rngp As Range
'cell with data to find
Fstring = Range("G13").Value
Pstring = Range("A2").Value
Bureauplanning = "\\nel-data\Document\Planning\Bureauplanning.xlsm"
Workbooks.Open (Bureauplanning)
With Sheets("Blad1").Range("G13:DI13")
Set rFind = .find(What:=Fstring, LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)
If Not rFind Is Nothing Then
MsgBox rFind.Column
End If
End With
With Sheets("Blad1").Range("F:F")
Set cFind = .find(What:=Pstring, LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)
If Not cFind Is Nothing Then
MsgBox cFind.Row
End If
End With
End Sub
The msgboxes just for checking if i get the good rows and columns.
I hope someone can help.
rFindis notNothing, can you not just do this within yourWithstatement:.Copy rFind.Address?