S
ste mac
Hello to all, I have almost got this thing working, my problem is
that it will not 'select' the correct sheet before looking for the
'idNumber'.. and l just don't know why... I have been messing
around with it for a couple of days... I think the rest of the
code will work once it finds the idNumber on the rightsheet..
Thanks for any help you can give...seeya ste
sub getdepthvalue()
Dim SheetName As String
Dim sheetNumber As Long
Dim rightSheet As Long
Dim idNumber As String
Dim activeid As String
Dim xlrow As Long
Dim scennumber As Variant
Dim thedepth As Long
Dim copyrange As Range
Sheets("Live History").Select
Sheets("Live History").Range("N1").End(xlDown).Select
ActiveCell.Offset(0, 5).Select
idNumber = ActiveCell.Value
For sheetNumber = 1 To 56
xlrow = 3
SheetName = "S" & Format(sheetNumber, "##0")
Sheets(SheetName).Select
rightSheet = Sheets("Live History").Range("H1").End(xlDown).Value
scennumber = ActiveSheet.Cells(3, 2).Value
If rightSheet = scennumber Then
ActiveSheet.Range("A3").Select
End If
Do Until ActiveCell.Value = idNumber
ActiveCell.Offset(1, 0).Select
Loop
If ActiveCell.Value = idNumber Then
ActiveCell.Offset(0, 9).Select
End If
ActiveCell.Copy
Set copyrange = ActiveCell
Sheets("Live History").Select
ActiveSheet.Range("P1").End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
End
Next
End
importdata
End Sub
that it will not 'select' the correct sheet before looking for the
'idNumber'.. and l just don't know why... I have been messing
around with it for a couple of days... I think the rest of the
code will work once it finds the idNumber on the rightsheet..
Thanks for any help you can give...seeya ste
sub getdepthvalue()
Dim SheetName As String
Dim sheetNumber As Long
Dim rightSheet As Long
Dim idNumber As String
Dim activeid As String
Dim xlrow As Long
Dim scennumber As Variant
Dim thedepth As Long
Dim copyrange As Range
Sheets("Live History").Select
Sheets("Live History").Range("N1").End(xlDown).Select
ActiveCell.Offset(0, 5).Select
idNumber = ActiveCell.Value
For sheetNumber = 1 To 56
xlrow = 3
SheetName = "S" & Format(sheetNumber, "##0")
Sheets(SheetName).Select
rightSheet = Sheets("Live History").Range("H1").End(xlDown).Value
scennumber = ActiveSheet.Cells(3, 2).Value
If rightSheet = scennumber Then
ActiveSheet.Range("A3").Select
End If
Do Until ActiveCell.Value = idNumber
ActiveCell.Offset(1, 0).Select
Loop
If ActiveCell.Value = idNumber Then
ActiveCell.Offset(0, 9).Select
End If
ActiveCell.Copy
Set copyrange = ActiveCell
Sheets("Live History").Select
ActiveSheet.Range("P1").End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
End
Next
End
importdata
End Sub