LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default Can't select range

The following code works until the last line:

Option Explicit

Public Sub TribalInvCheck()
Dim wbTribalHist As Workbook
Dim wbTribalTR As Workbook
Dim wsTribalTR As Worksheet
Dim wsTribalHist As Worksheet
Dim rTRCell As Range
Dim lTRRow As Long
Dim lHistRow As Long
Dim rFoundID As Range
Dim sTRID As String
Dim rTribalHist As Range
Dim lHistCol As Long

Set wbTribalHist = ThisWorkbook
Set wbTribalTR = ActiveWorkbook
Set wsTribalTR = ActiveSheet
Set wsTribalHist = wbTribalHist.Worksheets("Historical")
'Range set temporarily until I can find out how to set the range to the
longest column in the range
Set rTribalHist = wsTribalHist.Range("A3:Iv150")

'Application.ScreenUpdating = False

If ThisWorkbook.Name = ActiveWorkbook.Name Then
MsgBox "Please do not run this macro from the workbook that contains it."
_
& Chr(10) & "Please select a Turnaround Report and then restart this
macro."
Exit Sub
End If

Set rTRCell = wsTribalTR.Range("A3")
sTRID = rTRCell.Value

Set rFoundID = rTribalHist.Find(sTRID, LookIn:=xlValues)
'wsTribalHist.Activate
'rFoundID.Select

lTRRow = 3
lHistRow = rFoundID.Row + 2
lHistCol = rFoundID.Column

wsTribalHist.Activate
wsTribalHist.Range(Cells(lHistRow, lHistCol)).Select <--- Method range of
object worksheet failed

End Sub

Any ideas why it doesn't recognize this range?
Thanks!
 
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
How can change range to select active rows instead of :=Range("S10 ldiaz Excel Discussion (Misc queries) 7 August 29th 08 03:52 PM
macro to select range from active cell range name string aelbob Excel Programming 2 July 14th 08 09:19 PM
When entering data into a range of cells, select the entire range. Q Excel Discussion (Misc queries) 0 September 26th 07 04:36 AM
Compare a selected Range with a Named range and select cells that do not exist PCLIVE Excel Programming 1 October 18th 05 07:09 PM
Select Sheet then Select Range Gee[_2_] Excel Programming 3 May 27th 04 10:10 PM


All times are GMT +1. The time now is 06:10 AM.

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"