1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| Sub copy_Pres()
Sheets("Datum Press").Select
Dim cell_name As String
Dim column_number As Integer
Dim ref_date As String
Dim field As String
Dim Pressure As Integer
Range("A1").Select
Selection.Offset(1, 0).Select
Do While Not (IsEmpty(ActiveCell))
cell_name = ActiveCell.Text
Selection.Offset(0, 1).Select
ref_date = ActiveCell.Text
Selection.Offset(0, 5).Select
Pressure = ActiveCell.Value
Selection.Offset(0, 1).Select
field = ActiveCell.Text
MsgBox (field)
On Error GoTo errorhandler
Worksheets("Measured_" & field).Select
Range("A1:TZ1").Select
Selection.Find(What:=cell_name, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
column_number = ActiveCell.Column
Cells(5, column_number).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Find(What:=ref_date, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Select
Selection.Offset(0, 5).Select
ActiveCell.Value = Pressure
errorhandler:
Worksheets("Datum Press").Select
Selection.Offset(1, -7).Select
Loop
End Sub |
Partager