suddenflash
05-04-2012, 10:00 AM
Hi!
I wrote a little code. Because repeated action which is needed I decided to wrtite a function komponendid. I have not found the right way to call a user defined function.
But the code itself works ...
Sub otsibrh()
Dim rhsheet As Worksheet
Dim muutuja As Worksheet
Dim algmaterjal As Worksheet
Dim i1 As Integer
Dim j1 As Integer
Dim i As Integer
Dim otsi As Range
Dim rida As String
Dim Cat1
i = 1
j = 1
Set rhsheet = Sheets("Rhsheet")
Set algmaterjal = Sheets("algmaterjal")
' primary loop for searshing necessary letter combo
End Sub
Function komponendid(rida As String, muutuja As Worksheet)
Do While algmaterjal.Cells(i, 2) <> 0
rida = " Rh"
Set otsi = ActiveSheet.Cells(i, 2).Find(rida, MatchCase:=False)
If Not otsi Is Nothing Then
algmaterjal.Cells(i, 10) = "leidsin"
Cat1 = algmaterjal.Rows(i).Copy
muutuja.Rows(j).Insert Shift:=xlDown ', CopyOrigin:=xlFormatFromLeftOrAbove
j = j + 1
End If
i = i + 1
Loop ' end of primary loop
End Function
End Function
Sub programm()
konponendid(" Rh",rhsheet)
End Sub
komponendid shos an error massage
Many thanks ahead
Suddenflash
I wrote a little code. Because repeated action which is needed I decided to wrtite a function komponendid. I have not found the right way to call a user defined function.
But the code itself works ...
Sub otsibrh()
Dim rhsheet As Worksheet
Dim muutuja As Worksheet
Dim algmaterjal As Worksheet
Dim i1 As Integer
Dim j1 As Integer
Dim i As Integer
Dim otsi As Range
Dim rida As String
Dim Cat1
i = 1
j = 1
Set rhsheet = Sheets("Rhsheet")
Set algmaterjal = Sheets("algmaterjal")
' primary loop for searshing necessary letter combo
End Sub
Function komponendid(rida As String, muutuja As Worksheet)
Do While algmaterjal.Cells(i, 2) <> 0
rida = " Rh"
Set otsi = ActiveSheet.Cells(i, 2).Find(rida, MatchCase:=False)
If Not otsi Is Nothing Then
algmaterjal.Cells(i, 10) = "leidsin"
Cat1 = algmaterjal.Rows(i).Copy
muutuja.Rows(j).Insert Shift:=xlDown ', CopyOrigin:=xlFormatFromLeftOrAbove
j = j + 1
End If
i = i + 1
Loop ' end of primary loop
End Function
End Function
Sub programm()
konponendid(" Rh",rhsheet)
End Sub
komponendid shos an error massage
Many thanks ahead
Suddenflash