Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Command button copy array


I have a command button on sheet1 of a work sheet, part of what it does
is copy a range of cells to sheet 2. The code I am using seems rather
crude
For j = 1 To 2
For k = 1 To 2
Sheets("Sheet2").Cells(j, k) = Sheets("Sheet1").Cells(j, k)
Next k
Next j

Is there a smarter way of doing this by defing arrays in both sheets
and making sheet 2 array = sheet 1 array?

Grateful for your advices


--
Noslien
------------------------------------------------------------------------
Noslien's Profile: http://www.excelforum.com/member.php...o&userid=31701
View this thread: http://www.excelforum.com/showthread...hreadid=514186

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Command button copy array

Try something like

Worksheets("Sheet2").Range("A1:B2").Value = _
Worksheets("Sheet1").Range("A1:B2").Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Noslien"
wrote in message
...

I have a command button on sheet1 of a work sheet, part of what
it does
is copy a range of cells to sheet 2. The code I am using seems
rather
crude
For j = 1 To 2
For k = 1 To 2
Sheets("Sheet2").Cells(j, k) = Sheets("Sheet1").Cells(j, k)
Next k
Next j

Is there a smarter way of doing this by defing arrays in both
sheets
and making sheet 2 array = sheet 1 array?

Grateful for your advices


--
Noslien
------------------------------------------------------------------------
Noslien's Profile:
http://www.excelforum.com/member.php...o&userid=31701
View this thread:
http://www.excelforum.com/showthread...hreadid=514186



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Command button copy array


Many thanks for your help


--
Noslien
------------------------------------------------------------------------
Noslien's Profile: http://www.excelforum.com/member.php...o&userid=31701
View this thread: http://www.excelforum.com/showthread...hreadid=514186

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
copy cell by command button kalpesh Excel Worksheet Functions 1 December 28th 11 08:41 PM
Using Command Button to copy cells Pennington Excel Discussion (Misc queries) 1 April 29th 05 02:30 AM
Copy down command button sowetoddid[_49_] Excel Programming 1 June 16th 04 03:48 PM
copy & paste command button RENEE RINEHART Excel Programming 4 April 9th 04 06:10 AM
copy and delete command button Mark Kubicki Excel Programming 0 October 6th 03 08:20 PM


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