Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
What have I got wrong? (Macro),,,
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
What have I got wrong? (Macro),,,
try
idnumber=Sheets("Live History").Range("N1").End(xlDown).Offset(0, 5) "ste mac" wrote in message om... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
What have I got wrong? (Macro),,,
Thanks Don... nice one...
seeya ste |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
What wrong is macro with signcert? | Excel Discussion (Misc queries) | |||
Macro - Whats wrong? | Excel Worksheet Functions | |||
What is wrong with this Macro? | Excel Worksheet Functions | |||
Whats wrong with this macro please | Excel Discussion (Misc queries) | |||
macro results wrong | Charts and Charting in Excel |