PC Review


Reply
Thread Tools Rate Thread

copy multiple cells to another sheet

 
 
ComputerMech
Guest
Posts: n/a
 
      4th Jan 2009
Ok here is what I need help with.
In sheet 1 I have a Invoice I would like to create a database of my customers
So when I have wrote out the Invoice I would like to hit a command button
that would send it to WS 2 next empty row. What would be the best way to do
this.
 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      4th Jan 2009
Here is a sample of one method:

ActiveSheet.Selection.Copy Sheets(2).Range("A" & Range("A65536"). _
End(xlUp).Row + 1)

Will put the selected range from the ActiveSheet into the next available row
on sheet 2, assuming that column A of sheet 2 will be filled down as far as
all other columns.

"ComputerMech" wrote:

> Ok here is what I need help with.
> In sheet 1 I have a Invoice I would like to create a database of my customers
> So when I have wrote out the Invoice I would like to hit a command button
> that would send it to WS 2 next empty row. What would be the best way to do
> this.

 
Reply With Quote
 
ComputerMech
Guest
Posts: n/a
 
      5th Jan 2009
I have found the answer and have it working now thanks for all your help here
is the code that i ended up using

Sub Copy_Next_Each_Other()
Dim smallrng As Range, DestRange As Range
Dim DestSheet As Worksheet, Lr As Long
Dim SourceRange As Range, I As Integer

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

'fill in the Source Sheet and range
Set SourceRange =
Sheets("Sheet2").Range("f5,f6,f7,f8,c10,a13,a16,j32,j33,j41,i45")

'Fill in the destination sheet and call the LastRow
'function to find the last row
Set DestSheet = Sheets("Sheet6")
Lr = LastRow(DestSheet)
I = 1

For Each smallrng In SourceRange.Areas

'We make DestRange the same size as smallrng and use the
'Value property to give DestRange the same values
With smallrng
Set DestRange = DestSheet.Cells(Lr + 1, I) _
.Resize(.Rows.Count, .Columns.Count)
End With
DestRange.Value = smallrng.Value
I = I + smallrng.Columns.Count

Next smallrng

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

End Sub



Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function


Function LastCol(sh As Worksheet)
On Error Resume Next
LastCol = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Column
On Error GoTo 0
End Function


Function bIsBookOpen_RB(ByRef szBookName As String) As Boolean
' Rob Bovey
On Error Resume Next
bIsBookOpen_RB = Not (Application.Workbooks(szBookName) Is Nothing)
End Function

Please note that this is not my code but I have forgot the wed site to which
it came if anyone does know where it came from please post





"JLGWhiz" wrote:

> Here is a sample of one method:
>
> ActiveSheet.Selection.Copy Sheets(2).Range("A" & Range("A65536"). _
> End(xlUp).Row + 1)
>
> Will put the selected range from the ActiveSheet into the next available row
> on sheet 2, assuming that column A of sheet 2 will be filled down as far as
> all other columns.
>
> "ComputerMech" wrote:
>
> > Ok here is what I need help with.
> > In sheet 1 I have a Invoice I would like to create a database of my customers
> > So when I have wrote out the Invoice I would like to hit a command button
> > that would send it to WS 2 next empty row. What would be the best way to do
> > this.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy cells from 4 w'sheets in multiple w'books to 1 w'sheet in 1 w'book plant007 Microsoft Excel Misc 0 2nd Jun 2011 11:34 AM
Copy Sheet to new Sheet and clear cells on original sheets Boiler-Todd Microsoft Excel Misc 7 23rd Sep 2009 10:02 PM
copy cells from multiple pages to one sheet w/ if statement GHall Microsoft Excel Worksheet Functions 8 15th Jan 2009 08:24 PM
Formula to copy multiple cells onto another sheet cdcam Microsoft Excel New Users 3 10th Jul 2008 12:19 AM
macro copy/paste data from multiple cells to multiple cells =?Utf-8?B?RGlhbmE=?= Microsoft Excel Misc 0 10th Jul 2006 09:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:28 AM.