ich hab schon im Archiv gesucht aber ich raffe es einfach nicht. Ich will Zellen inklusive Hyperlink von einem Arbeitsblatt in ein anderes Arbeitsblatt derselben Arbeitsmappe kopieren.
Kontext: ich habe Userforms erstellt, wo man Produkte auswählen kann mittels checkboxes.
Mit dem Code unten suche ich die ausgewählten Produkte in meiner Produkttabelle (ein anderes Arbeitsblatt ) und kopiere die Produktinfos in das "bill of Material" Arbeitsblatt. Der Hyperlonk ist in der zelle, wo " 'copies MID " als Kommentar dahinter steht
Zum kopieren benutze ich folgenden Code:
For Each cnt In Controls 'controls=steuerelemente, loop until all controls of the form have been checked
If TypeName(cnt) = "CheckBox" Then
If cnt.Value = True Then
cnt.Value = False 'activates product sheet
Worksheets(cnt.Caption).Activate
For RowCount = 2 To 100 ' max nr. of products per category is 100
If Sheets(cnt.Caption).Cells(RowCount, 1) = cnt.Name Then
Sheets("Bill of Material").Cells(BoMRow, 1) = LineNumber
Sheets("Bill of Material").Cells(BoMRow, 2) = Sheets(cnt.Caption).Cells(RowCount, 3) 'copies prod description to BOM
Sheets("Bill of Material").Cells(BoMRow, 3) = Sheets(cnt.Caption).Cells(RowCount, 4) 'copies prod code
Sheets("Bill of Material").Cells(BoMRow, 4) = Sheets(cnt.Caption).Cells(RowCount, 5) 'copies MID
BoMRow = BoMRow + 1
LineNumber = LineNumber + 1
End If
Next RowCount
End If
End If
Ich dachte, ich kopiere einfach die Zelle aber damit ist es offensichtlich nicht getan
Bitte kann mich da jemand in die richtige Richtung schubsen.
danke und viele Grüsse
Jürgen