V
Varun
Hi,
I need to convert the sub procedure that extracts some values and puts them
in an array (named logical_layer2) into a function. How can I go about doing
this?
Any help is appreciated. Thanks.
Sub extract_tech_file()
Dim startrow1, currow1, h As Integer
Dim n As Integer, p As Integer
Dim logical_layer2() As Variant
ReDim logical_layer2(1 To 100)
Worksheets("Temp3").Cells.Find(What:="$$define_physical_layer",
After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlDown, MatchCase:=False, SearchFormat:=False).Activate
startrow1 = ActiveCell.Row
'add initial array here
n = 1
logical_layer2(n) = Worksheets("Temp3").Cells(startrow1, 3)
n = n + 1
Do While startrow1 <> currow1
Cells.FindNext(After:=ActiveCell).Activate
currow1 = ActiveCell.Row
If currow1 <> startrow1 Then
logical_layer2(n) = Worksheets("Temp3").Cells(currow1, 3)
n = n + 1
End If
Loop
I need to convert the sub procedure that extracts some values and puts them
in an array (named logical_layer2) into a function. How can I go about doing
this?
Any help is appreciated. Thanks.
Sub extract_tech_file()
Dim startrow1, currow1, h As Integer
Dim n As Integer, p As Integer
Dim logical_layer2() As Variant
ReDim logical_layer2(1 To 100)
Worksheets("Temp3").Cells.Find(What:="$$define_physical_layer",
After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlDown, MatchCase:=False, SearchFormat:=False).Activate
startrow1 = ActiveCell.Row
'add initial array here
n = 1
logical_layer2(n) = Worksheets("Temp3").Cells(startrow1, 3)
n = n + 1
Do While startrow1 <> currow1
Cells.FindNext(After:=ActiveCell).Activate
currow1 = ActiveCell.Row
If currow1 <> startrow1 Then
logical_layer2(n) = Worksheets("Temp3").Cells(currow1, 3)
n = n + 1
End If
Loop