LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default Smaller VBA? Loop or Offset?

I'm using the following code to import values from one worksheet to another...

Private Sub CB1_Click()

Dim From As Worksheet
Dim Result As Worksheet

Set From = Worksheets("October")
Set Result = Worksheets("OctVariance")

'From is next 4 columns for each Result plus 1 row

Result.Range("C5:F5").Value = From.Range("C3:F3").Value
Result.Range("C6:F6").Value = From.Range("G3:J3").Value
Result.Range("C7:F7").Value = From.Range("K3:N3").Value
Result.Range("C8:F8").Value = From.Range("O3:R3").Value
Result.Range("C9:F9").Value = From.Range("S3:V3").Value
Result.Range("C10:F10").Value = From.Range("W3:Z3").Value
Result.Range("C11:F11").Value = From.Range("AA3:AD3").Value
Result.Range("C12:F12").Value = From.Range("AE3:AH3").Value
Result.Range("C13:F13").Value = From.Range("AI3:AL3").Value
Result.Range("C14:F14").Value = From.Range("AM3:AP3").Value
Result.Range("C15:F15").Value = From.Range("AQ3:AT3").Value
Result.Range("C16:F16").Value = From.Range("AU3:AX3").Value
Result.Range("C17:F17").Value = From.Range("AY3:BB3").Value
Result.Range("C18:F18").Value = From.Range("BC3:BF3").Value
Result.Range("C19:F19").Value = From.Range("BG3:BJ3").Value
Result.Range("C20:F20").Value = From.Range("BK3:BN3").Value
Result.Range("C21:F21").Value = From.Range("BO3:BR3").Value



End Sub

Can this be done with a leaner/smaller sub? Thanks for your help.
 
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
Offset in for loop not working StumpedAgain Excel Programming 4 June 2nd 08 07:41 PM
Find, Copy offset to offset on other sheet, Run-time 1004. Finny[_3_] Excel Programming 10 December 7th 06 11:46 PM
Loop with activecell.offset mthomas[_17_] Excel Programming 3 November 18th 05 09:29 PM
Need offset range for loop Joe Fish Excel Programming 8 October 17th 05 01:13 AM
Nested Loop Offset Glitch - Object required (Error 424) Arturo Excel Programming 1 November 21st 04 05:05 PM


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