#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default transfer macro

Hi
I have thefollowing macro to transfer information from one sheet to anothe
however it doesnt like the 'Lr = lastRow("DestSheet")' can anyone please help?
Sub Transfer()
Dim SourceRange As Range, DestRange As Range
Dim DestSheet As Worksheet, Lr As Long

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

Set SourceRange = Sheets("Outstanding").Range("a13:T13")

Set DestSheet = Sheets("Paid")
Lr = lastRow("DestSheet")

Set DestRange = DestSheet.Range("A" & Lr + 1)

SourceRange.Copy
DestRange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False

With Application
.ScreenUpdating = True
.EnableEvents = True
End With

End Sub

--
Warm
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default transfer macro

Hi,

Try this

Sub Transfer()
Dim SourceRange As Range, DestRange As Range
Dim DestSheet As String, Lr As Long
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set SourceRange = Sheets("Outstanding").Range("a13:T13")
DestSheet = "Paid"
Lr = Sheets(DestSheet).Cells.SpecialCells(xlLastCell).R ow
Set DestRange = Sheets(DestSheet).Range("A" & Lr + 1)
SourceRange.Copy
DestRange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub


Mike

"Warm" wrote:

Hi
I have thefollowing macro to transfer information from one sheet to anothe
however it doesnt like the 'Lr = lastRow("DestSheet")' can anyone please help?
Sub Transfer()
Dim SourceRange As Range, DestRange As Range
Dim DestSheet As Worksheet, Lr As Long

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

Set SourceRange = Sheets("Outstanding").Range("a13:T13")

Set DestSheet = Sheets("Paid")
Lr = lastRow("DestSheet")

Set DestRange = DestSheet.Range("A" & Lr + 1)

SourceRange.Copy
DestRange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False

With Application
.ScreenUpdating = True
.EnableEvents = True
End With

End Sub

--
Warm

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default transfer macro

Hi,
i have tried the macro below however i am now getting a compile warning:
'Only comments may appear after end sub, end function or end property!?


--
Warm


"Mike H" wrote:

Hi,

Try this

Sub Transfer()
Dim SourceRange As Range, DestRange As Range
Dim DestSheet As String, Lr As Long
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set SourceRange = Sheets("Outstanding").Range("a13:T13")
DestSheet = "Paid"
Lr = Sheets(DestSheet).Cells.SpecialCells(xlLastCell).R ow
Set DestRange = Sheets(DestSheet).Range("A" & Lr + 1)
SourceRange.Copy
DestRange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub


Mike

"Warm" wrote:

Hi
I have thefollowing macro to transfer information from one sheet to anothe
however it doesnt like the 'Lr = lastRow("DestSheet")' can anyone please help?
Sub Transfer()
Dim SourceRange As Range, DestRange As Range
Dim DestSheet As Worksheet, Lr As Long

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

Set SourceRange = Sheets("Outstanding").Range("a13:T13")

Set DestSheet = Sheets("Paid")
Lr = lastRow("DestSheet")

Set DestRange = DestSheet.Range("A" & Lr + 1)

SourceRange.Copy
DestRange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False

With Application
.ScreenUpdating = True
.EnableEvents = True
End With

End Sub

--
Warm

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 896
Default transfer macro

looks like your macro is looking for a private function named
"lastrow" and cannot find it
instead of
Set DestSheet = Sheets("Paid")
Lr = lastRow("DestSheet")

use:
Set DestSheet = Sheets("Paid")
Sheets("Paid").Activate
Lr = ActiveCell.SpecialCells(xlCellTypeLastCell).Row

HIH

On 28 Maj, 10:50, Warm wrote:
Hi
I have thefollowing macro to transfer information from one sheet to anothe
however it doesnt like the 'Lr = lastRow("DestSheet")' can anyone please help?
Sub Transfer()
Dim SourceRange As Range, DestRange As Range
Dim DestSheet As Worksheet, Lr As Long

With Application
* * .ScreenUpdating = False
* * .EnableEvents = False
End With

Set SourceRange = Sheets("Outstanding").Range("a13:T13")

Set DestSheet = Sheets("Paid")
Lr = lastRow("DestSheet")

Set DestRange = DestSheet.Range("A" & Lr + 1)

SourceRange.Copy
DestRange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False

With Application
* * .ScreenUpdating = True
* * .EnableEvents = True
* * End With

End Sub

--
Warm


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default transfer macro

Sorry got it working now. Sorry to be a pain but is there any way i can
modify it for another sheet so that it only transfers the information if
there is an 'x' in column
T ?
--
Warm


"Warm" wrote:

Hi
I have thefollowing macro to transfer information from one sheet to anothe
however it doesnt like the 'Lr = lastRow("DestSheet")' can anyone please help?
Sub Transfer()
Dim SourceRange As Range, DestRange As Range
Dim DestSheet As Worksheet, Lr As Long

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

Set SourceRange = Sheets("Outstanding").Range("a13:T13")

Set DestSheet = Sheets("Paid")
Lr = lastRow("DestSheet")

Set DestRange = DestSheet.Range("A" & Lr + 1)

SourceRange.Copy
DestRange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False

With Application
.ScreenUpdating = True
.EnableEvents = True
End With

End Sub

--
Warm



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default transfer macro

Set rng = Range("T1:T" & lr)
For Each c In rng
If c = "x" Then
do the copy part


Gord Dibben MS Excel MVP

On Thu, 28 May 2009 07:41:03 -0700, Warm
wrote:

Sorry got it working now. Sorry to be a pain but is there any way i can
modify it for another sheet so that it only transfers the information if
there is an 'x' in column
T ?


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
transfer datas into different sheet using macro? joana0907 Excel Discussion (Misc queries) 2 April 29th 09 09:45 AM
Transfer Macro code to another computer Corey Excel Discussion (Misc queries) 0 May 24th 06 11:09 PM
Transfer Macro to another user Poolpa New Users to Excel 2 March 29th 06 04:15 AM
Macro transfer Dan Wilson Excel Worksheet Functions 2 April 12th 05 03:21 AM
Transfer a macro kaw Excel Discussion (Misc queries) 1 February 10th 05 08:14 PM


All times are GMT +1. The time now is 11:27 AM.

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"