Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Referencing A Workbook

I have a command button that works well but I've decided I do not want my
form and my Log in the same workbook. How can I change this code to paste
the information into a different workbook named 'Void Log' rather than the
sheet named "Void Log". Also, I can't get my paste special to work
correctly. I only want the values to paste and not the formats or formulas.
I'm using Excel 2003 and this code is letting me paste multiple cells from
one worksheet (my Void Form) into the next blank row of another worksheet (my
Void Log).

With Sheets("Void Log")
Set myDest = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With

With ActiveSheet
.Range("a3").Copy
Paste (myDest)
.Range("b5").Copy
Paste (myDest.Offset(0, 1))
.Range("c8").Copy
Paste (myDest.Offset(0, 2))
.Range("b10").Copy
Paste (myDest.Offset(0, 3))
.Range("A3").Activate
End With

Any help would be appreciated.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Referencing A Workbook

Check out the below code..Mention the sheet name for the workbook Void Log.
The default is given as Sheet1.

Sub Macro()

Dim ws As Worksheet

Set ws = ActiveSheet
With Workbooks("Void Log.xls").Sheets("Sheet1")
Set mydest = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With

mydest.Value = ws.Range("a3").Value
mydest.Offset(0, 1) = ws.Range("b5").Value
mydest.Offset(0, 2) = ws.Range("c8").Value
mydest.Offset(0, 3) = ws.Range("b10").Value

End Sub

--
Jacob


"Axanamoon" wrote:

I have a command button that works well but I've decided I do not want my
form and my Log in the same workbook. How can I change this code to paste
the information into a different workbook named 'Void Log' rather than the
sheet named "Void Log". Also, I can't get my paste special to work
correctly. I only want the values to paste and not the formats or formulas.
I'm using Excel 2003 and this code is letting me paste multiple cells from
one worksheet (my Void Form) into the next blank row of another worksheet (my
Void Log).

With Sheets("Void Log")
Set myDest = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With

With ActiveSheet
.Range("a3").Copy
Paste (myDest)
.Range("b5").Copy
Paste (myDest.Offset(0, 1))
.Range("c8").Copy
Paste (myDest.Offset(0, 2))
.Range("b10").Copy
Paste (myDest.Offset(0, 3))
.Range("A3").Activate
End With

Any help would be appreciated.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Referencing A Workbook

It works perfect, thank you so much. You don't know how much easier my job
is going to be now.

"Jacob Skaria" wrote:

Check out the below code..Mention the sheet name for the workbook Void Log.
The default is given as Sheet1.

Sub Macro()

Dim ws As Worksheet

Set ws = ActiveSheet
With Workbooks("Void Log.xls").Sheets("Sheet1")
Set mydest = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With

mydest.Value = ws.Range("a3").Value
mydest.Offset(0, 1) = ws.Range("b5").Value
mydest.Offset(0, 2) = ws.Range("c8").Value
mydest.Offset(0, 3) = ws.Range("b10").Value

End Sub

--
Jacob


"Axanamoon" wrote:

I have a command button that works well but I've decided I do not want my
form and my Log in the same workbook. How can I change this code to paste
the information into a different workbook named 'Void Log' rather than the
sheet named "Void Log". Also, I can't get my paste special to work
correctly. I only want the values to paste and not the formats or formulas.
I'm using Excel 2003 and this code is letting me paste multiple cells from
one worksheet (my Void Form) into the next blank row of another worksheet (my
Void Log).

With Sheets("Void Log")
Set myDest = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With

With ActiveSheet
.Range("a3").Copy
Paste (myDest)
.Range("b5").Copy
Paste (myDest.Offset(0, 1))
.Range("c8").Copy
Paste (myDest.Offset(0, 2))
.Range("b10").Copy
Paste (myDest.Offset(0, 3))
.Range("A3").Activate
End With

Any help would be appreciated.


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 worksheets to a new workbook without formulae referencing original workbook [email protected] Excel Programming 2 October 16th 06 07:31 PM
referencing workbook from cells in another workbook jlejehan[_3_] Excel Programming 2 May 3rd 06 03:24 PM
Referencing a different Workbook Ken Excel Worksheet Functions 8 November 24th 05 01:20 AM
Referencing another Workbook Bill Martin -- (Remove NOSPAM from address) Excel Discussion (Misc queries) 0 April 6th 05 07:16 PM
Referencing one workbook in other??? Haldun Alay[_2_] Excel Programming 3 August 20th 03 04:29 PM


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