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

Can't find my original post. Thank you to all who provided input to the
original post. Here is what I currently use (called from a toolbar):
Sub SelectItem()
'
' SelectItem Macro
' Macro recorded 05/21/2007 by EuGene C. White, CNA
'
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Sheets("Orders").Select
Range("ID").Select
Selection.Copy
Range("A31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
' Insert code for date here?
Range("B31").Select
ActiveCell.FormulaR1C1 = "=NOW()"
Range("O_STSC").Select
Application.CutCopyMode = False
Selection.Copy
Range("C31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Range("O_TEBC2").Select
Application.CutCopyMode = False
Selection.Copy
Range("D31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Range("O_TPPC").Select
Application.CutCopyMode = False
Selection.Copy
Range("E31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Range("F31").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=SUM(RC[-3],RC[-2],RC[-1])"
Range("O_FSP").Select
Selection.Copy
Range("G31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A31:G31").Select
Selection.Copy
Sheets("Profit_Loss_Statement").Select
Range("A2").Select
Do Until Cells(ActiveCell.Row + 1, 1) = ""

If ActiveCell = "" Then
ActiveCell.Offset(1, 1).Select
Else
Cells(ActiveCell.Row + 1, 1).Select
End If
Loop
Cells(ActiveCell.Row + 1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Sheets("Orders").Select
Range("A31:G31").Select
Selection.ClearContents
Range("ID").Select
Application.CutCopyMode = False
End Sub

Might not be the best solution, but it works. I have not done any Excel VBA
before, just Word and VBScript.
/s/ Gene
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Copying from one worksheet to another worksheet

You should try to do withOUT selections as they are rarely necessary and
slow down code. You probably won't need the application off/on.
Use the with statement as you did with those. Don't forget to put the .
s in the right places.

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

with Sheets("Orders")
.range("A31").value=.Range("ID")
.Range("A31")=NOW()
.Range("C1").value=.Range("OF_SETS")
'etc
Range("OF_TEBC2").Select
Application.CutCopyMode = False
Selection.Copy
Range("D31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Range("O_TPPC").Select
Application.CutCopyMode = False
Selection.Copy
Range("E31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Range("F31").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=SUM(RC[-3],RC[-2],RC[-1])"
Range("O_FSP").Select
Selection.Copy
Range("G31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
'------
.Range("A31:G31").Copy Sheets("Profit_Loss_Statement").Range("A2")

'????
Do Until Cells(ActiveCell.Row + 1, 1) = ""
If ActiveCell = "" Then
ActiveCell.Offset(1, 1).Select
Else
Cells(ActiveCell.Row + 1, 1).Select
End If
Loop
Cells(ActiveCell.Row + 1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Sheets("Orders").Range("A31:G31").ClearContents

' Range("ID").Select
Application.CutCopyMode = False


With Application
.ScreenUpdating =true
.EnableEvents =true
End With

End Sub


--
Don Guillett
SalesAid Software

"Gene" wrote in message
...
Can't find my original post. Thank you to all who provided input to the
original post. Here is what I currently use (called from a toolbar):
Sub SelectItem()
'
' SelectItem Macro
' Macro recorded 05/21/2007 by EuGene C. White, CNA
'
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Sheets("Orders").Select
Range("ID").Select
Selection.Copy
Range("A31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
' Insert code for date here?
Range("B31").Select
ActiveCell.FormulaR1C1 = "=NOW()"
Range("O_STSC").Select
Application.CutCopyMode = False
Selection.Copy
Range("C31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Range("O_TEBC2").Select
Application.CutCopyMode = False
Selection.Copy
Range("D31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Range("O_TPPC").Select
Application.CutCopyMode = False
Selection.Copy
Range("E31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Range("F31").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=SUM(RC[-3],RC[-2],RC[-1])"
Range("O_FSP").Select
Selection.Copy
Range("G31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A31:G31").Select
Selection.Copy
Sheets("Profit_Loss_Statement").Select
Range("A2").Select
Do Until Cells(ActiveCell.Row + 1, 1) = ""

If ActiveCell = "" Then
ActiveCell.Offset(1, 1).Select
Else
Cells(ActiveCell.Row + 1, 1).Select
End If
Loop
Cells(ActiveCell.Row + 1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Sheets("Orders").Select
Range("A31:G31").Select
Selection.ClearContents
Range("ID").Select
Application.CutCopyMode = False
End Sub

Might not be the best solution, but it works. I have not done any Excel
VBA
before, just Word and VBScript.
/s/ Gene


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Copying from one worksheet to another worksheet

Don,
Thank you very much. Learning Excel VBA should be rather easy with folks
like you to assist me.
/s/ Gene

"Don Guillett" wrote:

You should try to do withOUT selections as they are rarely necessary and
slow down code. You probably won't need the application off/on.
Use the with statement as you did with those. Don't forget to put the .
s in the right places.

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

with Sheets("Orders")
.range("A31").value=.Range("ID")
.Range("A31")=NOW()
.Range("C1").value=.Range("OF_SETS")
'etc
Range("OF_TEBC2").Select
Application.CutCopyMode = False
Selection.Copy
Range("D31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Range("O_TPPC").Select
Application.CutCopyMode = False
Selection.Copy
Range("E31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Range("F31").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=SUM(RC[-3],RC[-2],RC[-1])"
Range("O_FSP").Select
Selection.Copy
Range("G31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
'------
.Range("A31:G31").Copy Sheets("Profit_Loss_Statement").Range("A2")

'????
Do Until Cells(ActiveCell.Row + 1, 1) = ""
If ActiveCell = "" Then
ActiveCell.Offset(1, 1).Select
Else
Cells(ActiveCell.Row + 1, 1).Select
End If
Loop
Cells(ActiveCell.Row + 1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Sheets("Orders").Range("A31:G31").ClearContents

' Range("ID").Select
Application.CutCopyMode = False


With Application
.ScreenUpdating =true
.EnableEvents =true
End With

End Sub


--
Don Guillett
SalesAid Software

"Gene" wrote in message
...
Can't find my original post. Thank you to all who provided input to the
original post. Here is what I currently use (called from a toolbar):
Sub SelectItem()
'
' SelectItem Macro
' Macro recorded 05/21/2007 by EuGene C. White, CNA
'
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Sheets("Orders").Select
Range("ID").Select
Selection.Copy
Range("A31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
' Insert code for date here?
Range("B31").Select
ActiveCell.FormulaR1C1 = "=NOW()"
Range("O_STSC").Select
Application.CutCopyMode = False
Selection.Copy
Range("C31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Range("O_TEBC2").Select
Application.CutCopyMode = False
Selection.Copy
Range("D31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Range("O_TPPC").Select
Application.CutCopyMode = False
Selection.Copy
Range("E31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Range("F31").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=SUM(RC[-3],RC[-2],RC[-1])"
Range("O_FSP").Select
Selection.Copy
Range("G31").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A31:G31").Select
Selection.Copy
Sheets("Profit_Loss_Statement").Select
Range("A2").Select
Do Until Cells(ActiveCell.Row + 1, 1) = ""

If ActiveCell = "" Then
ActiveCell.Offset(1, 1).Select
Else
Cells(ActiveCell.Row + 1, 1).Select
End If
Loop
Cells(ActiveCell.Row + 1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
Sheets("Orders").Select
Range("A31:G31").Select
Selection.ClearContents
Range("ID").Select
Application.CutCopyMode = False
End Sub

Might not be the best solution, but it works. I have not done any Excel
VBA
before, just Word and VBScript.
/s/ Gene



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
Copying the active worksheet to another worksheet in the same work queenmaam Excel Worksheet Functions 5 March 25th 08 06:56 PM
Looking up a variable in one worksheet and copying information from another column to another worksheet?? Brad Torken Excel Discussion (Misc queries) 2 December 10th 06 06:02 AM
Copying a worksheet witrh protected cells to a new worksheet John Excel Worksheet Functions 2 February 1st 06 02:19 PM
Multiple Worksheet copying to a master worksheet Jayhawktc[_3_] Excel Programming 4 August 11th 04 03:35 PM
Copying Worksheet triggers Click event of combobox on another worksheet Robert[_20_] Excel Programming 0 January 23rd 04 07:40 PM


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