#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 150
Default VB Code Question

Can someone assist me with some Excel VB code?

In the example below, I want to cut the date from the current worksheet
(Sheet1) and paste it into multpile cells in another worksheet (Sheet2)
within the same workbook.

What is the best way to reference each worksheet? I tried Sheet2! but that
didn't work for me.

Range("A1").Select
Selection.Cut Destination:=Range("A1,B1,C1") 'this needs to be pasted in
a new worksheet within the same workbook.


Many thanks if you can help!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default VB Code Question

Stan

Try this.

Sub foo()

ActiveSheet.Range("A1:C1").Cut _
Destination:=Sheets("Sheet2").Range("A1")

End Sub

You could use Sheets("Sheet1").Range("A1:C1") and run it from any sheet.


Gord Dibben MS Excel MVP

On Wed, 2 May 2007 11:34:00 -0700, Stan wrote:

Can someone assist me with some Excel VB code?

In the example below, I want to cut the date from the current worksheet
(Sheet1) and paste it into multpile cells in another worksheet (Sheet2)
within the same workbook.

What is the best way to reference each worksheet? I tried Sheet2! but that
didn't work for me.

Range("A1").Select
Selection.Cut Destination:=Range("A1,B1,C1") 'this needs to be pasted in
a new worksheet within the same workbook.


Many thanks if you can help!


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
VB Code Question Stan Excel Discussion (Misc queries) 6 April 30th 07 11:27 PM
VBA code question JEV Excel Discussion (Misc queries) 2 March 1st 07 06:02 PM
question about excessive code in replacing #N/A when using VLOOKUP njuneardave Excel Discussion (Misc queries) 4 June 21st 06 03:14 AM
Easy VB code question Anthony Excel Discussion (Misc queries) 2 July 8th 05 08:45 PM
syntax question - cell references in VB code needyourhelp New Users to Excel 1 March 2nd 05 08:52 PM


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