Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In Excel 2003 what do I need to change in this piece of code to only copy
values? ThisWorkbook.Worksheets("source_sheet").Range(Cell s(Jour_Rw, 1), Cells(Jour_Rw, 18)).copy Destination:=wb.Worksheets("target-sheet").Cells(FCDB_Rw, 1) An easy one I guess, but still... Thanks The Doctor |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way
Dim SourceRange As Range, DestRange As Range Set SourceRange = ThisWorkbook.Worksheets("source_sheet").Range(Cell s(Jour_Rw, 1), Cells(Jour_Rw, 18)) Set DestRange = wb.Worksheets("target-sheet").Cells(FCDB_Rw, 1) 'We make DestRange the same size as SourceRange and use the Value 'property to give DestRange the same values With SourceRange Set DestRange = DestRange.Resize(.Rows.Count, .Columns.Count) End With DestRange.Value = SourceRange.Value -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Dr. Schwartz" wrote in message ... In Excel 2003 what do I need to change in this piece of code to only copy values? ThisWorkbook.Worksheets("source_sheet").Range(Cell s(Jour_Rw, 1), Cells(Jour_Rw, 18)).copy Destination:=wb.Worksheets("target-sheet").Cells(FCDB_Rw, 1) An easy one I guess, but still... Thanks The Doctor |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You cannot use the copy:destination construct when you want to restrict the
copy use the following instead ThisWorkbook.Worksheets("source_sheet").Range(Cell s(Jour_Rw, 1), Cells(Jour_Rw, 18)).Copy wb.Worksheets("target-sheet").Cells(FCDB_Rw, 1).PasteSpecial Paste:=xlPasteValues Application.CutCopyMode = False -- Regards, Nigel "Dr. Schwartz" wrote in message ... In Excel 2003 what do I need to change in this piece of code to only copy values? ThisWorkbook.Worksheets("source_sheet").Range(Cell s(Jour_Rw, 1), Cells(Jour_Rw, 18)).copy Destination:=wb.Worksheets("target-sheet").Cells(FCDB_Rw, 1) An easy one I guess, but still... Thanks The Doctor |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Watch your unqualified ranges:
Set SourceRange = ThisWorkbook.Worksheets("source_sheet") _ .Range(Cells(Jour_Rw, 1), Cells(Jour_Rw, 18)) I'd use: with thisworkbook.worksheets("source_sheet") Set SourceRange = .Range(.Cells(Jour_Rw, 1), .Cells(Jour_Rw, 18)) End with (a couple of extra dots.) Ron de Bruin wrote: One way Dim SourceRange As Range, DestRange As Range Set SourceRange = ThisWorkbook.Worksheets("source_sheet").Range(Cell s(Jour_Rw, 1), Cells(Jour_Rw, 18)) Set DestRange = wb.Worksheets("target-sheet").Cells(FCDB_Rw, 1) 'We make DestRange the same size as SourceRange and use the Value 'property to give DestRange the same values With SourceRange Set DestRange = DestRange.Resize(.Rows.Count, .Columns.Count) End With DestRange.Value = SourceRange.Value -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Dr. Schwartz" wrote in message ... In Excel 2003 what do I need to change in this piece of code to only copy values? ThisWorkbook.Worksheets("source_sheet").Range(Cell s(Jour_Rw, 1), Cells(Jour_Rw, 18)).copy Destination:=wb.Worksheets("target-sheet").Cells(FCDB_Rw, 1) An easy one I guess, but still... Thanks The Doctor -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Oops. I see you copied|pasted from the OP.
Ron de Bruin wrote: One way Dim SourceRange As Range, DestRange As Range Set SourceRange = ThisWorkbook.Worksheets("source_sheet").Range(Cell s(Jour_Rw, 1), Cells(Jour_Rw, 18)) Set DestRange = wb.Worksheets("target-sheet").Cells(FCDB_Rw, 1) 'We make DestRange the same size as SourceRange and use the Value 'property to give DestRange the same values With SourceRange Set DestRange = DestRange.Resize(.Rows.Count, .Columns.Count) End With DestRange.Value = SourceRange.Value -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Dr. Schwartz" wrote in message ... In Excel 2003 what do I need to change in this piece of code to only copy values? ThisWorkbook.Worksheets("source_sheet").Range(Cell s(Jour_Rw, 1), Cells(Jour_Rw, 18)).copy Destination:=wb.Worksheets("target-sheet").Cells(FCDB_Rw, 1) An easy one I guess, but still... Thanks The Doctor -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes
Good catch Dave -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Dave Peterson" wrote in message ... Oops. I see you copied|pasted from the OP. Ron de Bruin wrote: One way Dim SourceRange As Range, DestRange As Range Set SourceRange = ThisWorkbook.Worksheets("source_sheet").Range(Cell s(Jour_Rw, 1), Cells(Jour_Rw, 18)) Set DestRange = wb.Worksheets("target-sheet").Cells(FCDB_Rw, 1) 'We make DestRange the same size as SourceRange and use the Value 'property to give DestRange the same values With SourceRange Set DestRange = DestRange.Resize(.Rows.Count, .Columns.Count) End With DestRange.Value = SourceRange.Value -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Dr. Schwartz" wrote in message ... In Excel 2003 what do I need to change in this piece of code to only copy values? ThisWorkbook.Worksheets("source_sheet").Range(Cell s(Jour_Rw, 1), Cells(Jour_Rw, 18)).copy Destination:=wb.Worksheets("target-sheet").Cells(FCDB_Rw, 1) An easy one I guess, but still... Thanks The Doctor -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy between worksheets does not copy formulae just values | Excel Discussion (Misc queries) | |||
Copy/Paste how to avoid the copy of formula cells w/o calc values | Excel Discussion (Misc queries) | |||
How do i compare values from two sheet and copy & paste if values match? | Excel Programming | |||
compare values between workbooks and copy values | Excel Programming | |||
Range COPY function - how to copy VALUES and not formulas | Excel Programming |