Kamis, 16 Juni 2011

Re: [ExcelVBA] Copying Data from a Range

 

If I remember correctly, you can only paste to the active sheet, so that
might be the issue?

On Thu, Jun 16, 2011 at 7:48 AM, Baljeet Bilkhu <baljeet_bilkhu@yahoo.ca>wrote:

>
> I'm trying to copy data within a particular range using the following code,
> but when I run it, no data is being copied:
>
> Sub Copy_Daily()
> Dim SourceRange As Range, DestRange As Range
> Dim DestSheet As Worksheet, SourceSheet As Worksheet, LcD As Long, LcS
> As Long
> Dim LastColumn As Integer
>
> With Application
> .ScreenUpdating = False
> .EnableEvents = False
> End With
>
> Set SourceSheet = Sheets("Daily Comp Count")
>
> LcS = SourceSheet.UsedRange.Column - 1 +
> SourceSheet.UsedRange.Columns.Count
>
> Set SourceRange = Sheets("Daily Comp Count").Range("O" & LcS)
>
> Set DestSheet = Sheets("Daily Comp Count")
>
> LcD = DestSheet.UsedRange.Column + 1 +
> SourceSheet.UsedRange.Columns.Count
>
> Set DestRange = DestSheet.Range("P" & LcD)
>
>
> SourceRange.Copy
> DestRange.PasteSpecial xlPasteValues, , False, False
> Application.CutCopyMode = False
> With Application
> .ScreenUpdating = True
> .EnableEvents = True
> End With
>
> End Sub
>
> Basically what I'm trying to do is to:
>
>
> Can anyone help with this.
>

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
.

__,_._,___

Tidak ada komentar:

Posting Komentar