Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1520to1524
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

kleines makro

kleines makro
28.10.2016 20:07:35
Hajo
Hallo
wer kann mal schauen. Habe eine kleine Beispielsdatei angefügt.
Nach einer Zahl über der Userform1 in der Tabelle Fahrstunden ab C5 ...suchen und die danebenstehende aus B5... kopieren und im Formular übertragen.
schon mal danke für die Mühe.
Gruß Hajo A
https://www.herber.de/bbs/user/109079.xlsm

5
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
einfacher mit Filter ...
28.10.2016 21:57:25
Matthias
Hallo
Das geht doch mit Bordmitteln viel einfacher
Einfach Filter setzen und nach 9 filtern
Fahrstunden

 BC
4System NrSchüler Nr
739
1069
1289
16129


Excel Tabellen im Web darstellen >> Excel Jeanie HTML 4.8
Nun markierst und kopierst Du Deine Werte
und fügt sie im Zielregisterblatt ein
Gruß Matthias
Anzeige
AW: kleines makro
28.10.2016 22:27:45
Bastian
Oder so in der Art geht das auch mit VBA
Gruß basti
Private Sub CommandButton1_Click() Dim Val As String Dim c As Range If IsNumeric(Me.TextBox1) Then With Worksheets("Fahrstunden").Columns(3) Set c = .Find(Me.TextBox1, LookIn:=xlValues, LookAt:=xlWhole) If Not c Is Nothing Then firstAddress = c.Address Do Val = Val & "," & c.Offset(0, -1) Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address firstAddress End If Val = Mid(Val, 2) End With With Worksheets("Formular") .Range(.Cells(29, 2), .Cells(29, 2).End(xlDown)).ClearContents If Val "" Then .Cells(29, 2).Resize(UBound(Split(Val, ",")) + 1) = WorksheetFunction.Transpose(Split(Val, ",")) _ End If End With End If End Sub
Anzeige
AW: kleines makro
29.10.2016 11:35:13
Hajo
Hallo Basti
danke für die Unterstützung in VBA. Ich brauche noch einen kleinen Hinweis bitte. Geht das so?
Dim Val As String
Dim c As Range
If IsNumeric(Me.TextBox1) Then
With Worksheets("UnterrichteTheorieGrund").Columns(3)
With Worksheets("UnterrichteKlassensp").Columns(3)
With Worksheets("Fahrstunden").Columns(3)
Set c = .Find(Me.TextBox1, LookIn:=xlValues, LookAt:=xlWhole)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Val = Val & "," & c.Offset(0, -1)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address firstAddress
End If
Val = Mid(Val, 2)
End With
With Worksheets("Formular")
.Range(.Cells(29, 2), .Cells(29, 2).End(xlDown)).ClearContents
If Val "" Then
.Cells(29, 2).Resize(UBound(Split(Val, ",")) + 1) = WorksheetFunction.Transpose(Split(Val, ","))
With Worksheets("Formular")
.Range(.Cells(29, 4), .Cells(29, 4).End(xlDown)).ClearContents
If Val "" Then
.Cells(29, 4).Resize(UBound(Split(Val, ",")) + 1) = WorksheetFunction.Transpose(Split(Val, ","))
With Worksheets("Formular")
.Range(.Cells(29, 6), .Cells(29, 6).End(xlDown)).ClearContents
If Val "" Then
.Cells(29, 6).Resize(UBound(Split(Val, ",")) + 1) = WorksheetFunction.Transpose(Split(Val, ","))
End If
End If
End If
End With
End With
End With
End If
Anzeige
AW: kleines makro
29.10.2016 12:27:59
Bastian
Hey Hajo A so geht das nicht
Mit With wird immer nur das betrachtet was da zwischen steht
with yyy
..... von yyy
with xxx
...... von xxx
end with (xxx)
..... von yyy
end with (yyy)
Du könntest es so versuchen
Gruß basti
Private Sub CommandButton1_Click()
Dim Val As String
Dim c As Range
Dim WSlist As String
Dim i As Long
Dim cc As Long
cc = 2
WSlist = "Fahrstunden,UnterrichteKlassensp,UnterrichteTheorieGrund"
If IsNumeric(Me.TextBox1) Then
For i = LBound(Split(WSlist, ",")) To UBound(Split(WSlist, ","))
With Worksheets(Split(WSlist, ",")(i)).Columns(3)
Set c = .Find(Me.TextBox1, LookIn:=xlValues, LookAt:=xlWhole)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Val = Val & "," & c.Offset(0, -1)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address  firstAddress
End If
Val = Mid(Val, 2)
End With
With Worksheets("Formular")
.Range(.Cells(29, cc), .Cells(29, cc).End(xlDown)).ClearContents
If Val  "" Then
.Cells(29, cc).Resize(UBound(Split(Val, ",")) + 1) = WorksheetFunction.Transpose(Split(Val, "," _
))
End If
End With
Val = ""
cc = cc + 2
Next
End If
End Sub

Anzeige
Dankeschön
29.10.2016 16:15:45
Hajo
Hallo Basti
danke für die tatkräftige Unterstützung.
Gruß Hajo A

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige