sinned
Goto Top

Marko zum Namen suchen und Wert kopieren in zwei Workbooks

Hi,

I need help! Ich brauche ein Makro, welches in einem Sheet nach einem Namen sucht, den Wert kopiert und diesen in einem anderem Workbook an einer bestimmten stelle pasted.

Mein Ansatz:
Sub CommandButton1_Click()

Application.ScreenUpdating = False 'Screen off  

Dim i, f As Integer
Dim v As Double
Dim DerName As String

'Excel Datei öffnen  
    Workbooks.Open Filename:= _
        "C:\Users\XXX\Desktop\Einlesen.xlsx"  
        
For i = 7 To i = 181

  Workbooks("Einlesen.xlsx").Activate  
  
  DerName = Sheets("E_R_F_O_L_G_S_R_E_C_H_N_U_N_G").Cells(i, 2).Value  
  
  Workbooks("Controlling-Tool.xlsx").Activate  
  
    If DerName = Workbooks("Controlling-Tool.xlsx").Sheets("GuV").Cells(i, 2).Value Then  
  
     If Workbooks("Controlling-Tool.xlsx").Sheets("GuV").Cells(2, 2).Value = "April" Then  
      f = 7
       Else:
        If Workbooks("Controlling-Tool.xlsx").Sheets("GuV-").Cells(2, 2).Value = "May" Then  
         f = 8
          Else:
           f = 9
          
           End If
       End If
    End If

  Workbooks("Einlesen.xlsx").Activate  
  
  v = Sheets("E_R_F_O_L_G_S_R_E_C_H_N_U_N_G").Cells(i, 3).Value  
  
  Workbooks("Controlling-Tool.xlsx").Activate  
  
  Workbooks("Controlling-Tool.xlsx").Sheets("GuV").Cells(i + 3, f).Value = v  
  
  
'if Sheets("E_R_F_O_L_G_S_R_E_C_H_N_U_N_G").Cells(WorksheetFunction.Match(DerName, Workbooks("Controlling-Tool").Sheets("GuV").coloums(3), 0), 2) = _  
'WorksheetFunction.VLookup(DerName, Sheets("E_R_F_O_L_G_S_R_E_C_H_N_U_N_G").Range("A:C"), 3, 0)  

Next i
 
    
End Sub

Jemand eine Idee? Danke!

Content-Key: 239309

Url: https://administrator.de/contentid/239309

Printed on: April 20, 2024 at 02:04 o'clock

Member: colinardo
Solution colinardo May 27, 2014 updated at 16:50:34 (UTC)
Goto Top
Moin sinned, Willkommen auf Administrator.de!
Das Thema hatten wir schon mehrmals, das sollte weiterhelfen:
oder dieses Demosheet

Range.Find() ist hier das Stichwort!

Grüße Uwe
Member: sinned
sinned May 27, 2014 at 16:50:29 (UTC)
Goto Top
Danke!