Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default What have I got wrong? (Macro),,,

Thanks Don... nice one...

seeya ste
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What wrong is macro with signcert? Eric Excel Discussion (Misc queries) 4 April 27th 10 11:35 PM
Macro - Whats wrong? NPell Excel Worksheet Functions 4 September 1st 08 10:51 AM
What is wrong with this Macro? jeannie v Excel Worksheet Functions 16 February 24th 08 05:05 PM
Whats wrong with this macro please Mike Excel Discussion (Misc queries) 6 February 5th 06 09:31 PM
macro results wrong Joseph Tibiita Charts and Charting in Excel 2 June 30th 05 05:32 PM


All times are GMT +1. The time now is 11:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"