Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Copying one work sheet to another

Hi - i am copying one worksheet to another and i notice that in its
destination only 255 characters of column D are being copied accross. In
some cases there are 700 characters that need to be copied accross. Help -
can this be resolved in any way?

The code that i am using is:
Dim mydata As String
'data location & range to copy
mydata = "='\\Macro\[Sedol_vlookup_reviews.xls]Paras'!$A$4:$D$300" '<<
change as required

'link to worksheet
With Worksheets("Reviews").Range("A4:D300") '<< change as required
.Formula = mydata

'convert formula to text
.Copy
.PasteSpecial Paste:=xlPasteValues
End With
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,276
Default Copying one work sheet to another

Hi,
in the code given the selected range to be copied is from row 4 to 300, you
have to change the range there for example from D4:D800, if you see in your
code there is a paragraph saying change as required

"Withnails" wrote:

Hi - i am copying one worksheet to another and i notice that in its
destination only 255 characters of column D are being copied accross. In
some cases there are 700 characters that need to be copied accross. Help -
can this be resolved in any way?

The code that i am using is:
Dim mydata As String
'data location & range to copy
mydata = "='\\Macro\[Sedol_vlookup_reviews.xls]Paras'!$A$4:$D$300" '<<
change as required

'link to worksheet
With Worksheets("Reviews").Range("A4:D300") '<< change as required
.Formula = mydata

'convert formula to text
.Copy
.PasteSpecial Paste:=xlPasteValues
End With

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Copying one work sheet to another

As already mentioned, you are copying a static range with your formulas you
either have to change the range manually or update the code to expand it
dynamically. To do this though, you will need a helper cell in the target
workbook worksheet.

In your workbook Sedol_vlookup_reviews.xls place this formula:
=COUNTA(D:D) in range F1 of the worksheet you are copying. Save and close
the workbook. If Range F1 is being used on your worksheet, amend the code to
another unused Cell in the worksheet.

Now try this updated code & see if it does what you want.

Sub GetData()
Dim mydata As String
Dim lr As Variant

'your helper cell
lr = "='\\Macro\[Sedol_vlookup_reviews.xls]Paras'!$F$1"


'link to worksheet
With Worksheets("Reviews")

With .Range("F1")
.Formula = lr
'convert formula to text
.Value = .Value
lr = .Value
End With

'data location & range to copy
mydata = "='\\Macro\[Sedol_vlookup_reviews.xls]Paras'!$A$4:$D$" & lr

With .Range("A4:D" & lr)
.Formula = mydata

'convert formula to text
.Value = .Value

End With

remove helper value
.Range("F1").Value = ""

End With

--
jb


"Withnails" wrote:

Hi - i am copying one worksheet to another and i notice that in its
destination only 255 characters of column D are being copied accross. In
some cases there are 700 characters that need to be copied accross. Help -
can this be resolved in any way?

The code that i am using is:
Dim mydata As String
'data location & range to copy
mydata = "='\\Macro\[Sedol_vlookup_reviews.xls]Paras'!$A$4:$D$300" '<<
change as required

'link to worksheet
With Worksheets("Reviews").Range("A4:D300") '<< change as required
.Formula = mydata

'convert formula to text
.Copy
.PasteSpecial Paste:=xlPasteValues
End With

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Copying one work sheet to another

Private Sub TryThisInstead()
Dim mydata As Variant
'data location & range to copy
mydata =
Workbooks("'\\Macro\[Sedol_vlookup_reviews.xls]").Worksheets("Paras").Range("$A$4:$D$300").Va lue
Worksheets("Reviews").Range("A4:D300").Value = mydata '<< change as
required
End Sub

Regards

Steve Dalton


"Withnails" wrote in message
...
Hi - i am copying one worksheet to another and i notice that in its
destination only 255 characters of column D are being copied accross. In
some cases there are 700 characters that need to be copied accross.
Help -
can this be resolved in any way?

The code that i am using is:
Dim mydata As String
'data location & range to copy
mydata = "='\\Macro\[Sedol_vlookup_reviews.xls]Paras'!$A$4:$D$300" '<<
change as required

'link to worksheet
With Worksheets("Reviews").Range("A4:D300") '<< change as required
.Formula = mydata

'convert formula to text
.Copy
.PasteSpecial Paste:=xlPasteValues
End With



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
help with copying multiple ranges and paste it on a work sheet based on conditions prakash Excel Discussion (Misc queries) 0 November 30th 06 10:18 AM
copying date from one sheet to another work sheet Jay Excel Worksheet Functions 13 September 25th 06 10:56 PM
Copying a work sheet cell reference as relative not absolute? Velson Excel Discussion (Misc queries) 4 January 7th 06 01:46 PM
copying and paste data from each worksheet to a summary work sheet mary Excel Programming 5 January 21st 05 05:25 PM
Copying a sheet to new work sheet Andy Kwok Excel Programming 2 November 24th 03 05:12 PM


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