Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default copy cell values to another workbook

I need help please, i am trying to get my copyRange to only copy the
1st 5 columns of the row
that it has found by using the .Find (FindFirst and FindLast)

With ActiveSheet
Set searchRange = .Range("F2:F" & FinalRow)
With searchRange
Set FindFirst = .Find(what:=WhatToFind, _
LookIn:=xlValues, lookat:=xlWhole, _
after:=.Cells(.Cells.Count), _
searchdirection:=xlNext)
Set FindLast = .Find(what:=WhatToFind, _
LookIn:=xlValues, lookat:=xlWhole, _
after:=.Cells(1),
searchdirection:=xlPrevious)
'Below is where i need the help....
Set copyRange = .Range(FindFirst, FindLast).EntireRow
End With
End With

'with out the .EntireRow
? copyrange.Address
$F$9:$F$182
'with the .EntireRow
? copyrange.Address
$9$182

Thanks for any help that is offered.

Keri~

here is the rest of the code...
Sub SendData()

Dim FindFirst As Range
Dim FindLast As Range
Dim searchRange As Range
Dim copyRange As Range
Dim WhatToFind As String
Dim destCell As Range
Dim FinalRow As Long
Dim sBook As Workbook
Dim sSheet As Worksheet
Dim dBook As Workbook
Dim dSheet As Worksheet
Dim strPri, strSec, strNon As String
Dim Primary, Secondary, NonProduction As String
Dim theName As String
Primary = "Primary"
Secondary = "Secondary"
NonProduction = "Non-Production"
FinalRow = Cells(Rows.Count, 6).End(xlUp).Row

'at some point i want it to loop though (Pimary,secondary and
nonproduction) in the .Find
'wanted to start with one, so i can understand it better
WhatToFind = "Primary"

Application.DisplayAlerts = False

Set sBook = ThisWorkbook 'or ActiveWorkbook ???
Set dBook = Workbooks.Open("E:\Excel\Portlet & Global Dev together
TEST\DesBook.xls")
Set dSheet = dBook.Sheets("Template")


For Each sSheet In sBook.Worksheets
sSheet.Activate
With ActiveSheet
Set searchRange = .Range("F2:F" & FinalRow)
With searchRange
Set FindFirst = .Find(what:=WhatToFind, _
LookIn:=xlValues, lookat:=xlWhole, _
after:=.Cells(.Cells.Count), _
searchdirection:=xlNext)
Set FindLast = .Find(what:=WhatToFind, _
LookIn:=xlValues, lookat:=xlWhole, _
after:=.Cells(1),
searchdirection:=xlPrevious)
'I need the help below
Set copyRange = .Range(FindFirst, FindLast)
End With
End With
If FindFirst Is Nothing Then
MsgBox "Nothing found"
Exit Sub
End If


theName = sSheet.Name

With dBook.Worksheets
dSheet.Copy after:=.Item(.Count)
ActiveSheet.Name = theName
Set destCell = Range("A8")
End With

copyRange.Copy Destination:=destCell

Next sSheet


End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default copy cell values to another workbook

I figured out this one, but have other questions i made about loops in
another post.

K~

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
VBA Copy values only onto new workbook Mara Excel Discussion (Misc queries) 1 May 5th 10 02:43 AM
Copy values of worksheet a to workbook b Nev Excel Discussion (Misc queries) 5 April 8th 09 09:35 PM
Copy Values From A Non-Open Workbook? Jeffrey_Chcgo Excel Programming 3 March 26th 06 11:58 PM
Copy Values From A Non-Open Workbook Jeffrey_Chcgo[_2_] Excel Programming 2 March 25th 06 04:19 PM
copy values from one workbook to another Jonsson Excel Programming 3 January 28th 04 09:47 PM


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

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

About Us

"It's about Microsoft Excel"