Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Range Object with Find and Offset

I'm working on a project that in essence will update many workbooks
using one as a template. One of the updates requires me to use data in
the 'old' book if available else use data from the template book. I'm
attempting to use find for a range and then offset from there to
populate some variables. Here's my code, I'm getting an 'object
doesn't support this method' error. Thanks in advance for any advice.
Note: the workbooks are global in scope as are any other variables not
defined in the sub.

Sub FixTab2()

Dim strT2Headings As String, strT2Value As String
Dim intT2Count As Integer
Dim Rng As Range
Dim wsSheet As Worksheet


wbWorking.SaveAs "P:\TestMosOld\" & Right(strSheet, 4) & "\" &
Right(strSheet, 4) & wbWorking.Name
wbTemplate.SaveAs Filename:=strCurPath


strCompany = wbWorking.Sheets(1).Range("COMPANY").Value
strSeries = wbWorking.Sheets(1).Range("SERIES").Value


For Each wsSheet In wbWorking.Worksheets

If wsSheet.Name Like "*tbl_type" Then
strSheet2 = wsSheet.Name
End If

Next

For intT2Count = 0 To 27

strT2Headings =
wbTemplate.Sheets(2).Range("A11").Offset(0,intT2Co unt).Value

Set Rng
=wbWorking.Sheets(strSheet2).Range("A11:IV11").Fin d(what:=strT2Headings)

If Not Rng Is Nothing Then

'Error occurs here

strT2Value = wbWorking.Sheets(strSheet2).Rng.Offset(1, 0).Value


wbTemplate.Sheets(2).Range("A11").Offset(1, intT2Count).Value =
strT2Value

End If

Next intT2Count

Set Rng = Nothing
wbTemplate.Sheets(2).Name = strSheet2

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Range Object with Find and Offset

Haven't tested it myself, but try

strT2Value = Rng.Offset(1, 0).Value

Rng already knows the book and sheet.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ctal" wrote in message
ups.com...
I'm working on a project that in essence will update many workbooks
using one as a template. One of the updates requires me to use data in
the 'old' book if available else use data from the template book. I'm
attempting to use find for a range and then offset from there to
populate some variables. Here's my code, I'm getting an 'object
doesn't support this method' error. Thanks in advance for any advice.
Note: the workbooks are global in scope as are any other variables not
defined in the sub.

Sub FixTab2()

Dim strT2Headings As String, strT2Value As String
Dim intT2Count As Integer
Dim Rng As Range
Dim wsSheet As Worksheet


wbWorking.SaveAs "P:\TestMosOld\" & Right(strSheet, 4) & "\" &
Right(strSheet, 4) & wbWorking.Name
wbTemplate.SaveAs Filename:=strCurPath


strCompany = wbWorking.Sheets(1).Range("COMPANY").Value
strSeries = wbWorking.Sheets(1).Range("SERIES").Value


For Each wsSheet In wbWorking.Worksheets

If wsSheet.Name Like "*tbl_type" Then
strSheet2 = wsSheet.Name
End If

Next

For intT2Count = 0 To 27

strT2Headings =
wbTemplate.Sheets(2).Range("A11").Offset(0,intT2Co unt).Value

Set Rng
=wbWorking.Sheets(strSheet2).Range("A11:IV11").Fin d(what:=strT2Headings)

If Not Rng Is Nothing Then

'Error occurs here

strT2Value = wbWorking.Sheets(strSheet2).Rng.Offset(1, 0).Value


wbTemplate.Sheets(2).Range("A11").Offset(1, intT2Count).Value =
strT2Value

End If

Next intT2Count

Set Rng = Nothing
wbTemplate.Sheets(2).Name = strSheet2

End Sub



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
Formula to find last value in a range & then offset [email protected] Excel Worksheet Functions 4 July 28th 06 05:54 PM
How to Select a relative range with Using "Find" and Offset() Dennis Excel Discussion (Misc queries) 7 July 27th 05 03:57 PM
Nested Loop Offset Glitch - Object required (Error 424) Arturo Excel Programming 1 November 21st 04 05:05 PM
Range object to Array object conversion Alan Beban[_3_] Excel Programming 0 August 1st 03 01:24 AM
Range object to Array object conversion Tom Ogilvy Excel Programming 0 August 1st 03 12:16 AM


All times are GMT +1. The time now is 10:35 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"