Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default Splitting a Procedure

Typo, Tom. Should be

For i = 0 To 6

not 7. But I prefer Lbound and UBound, to avoid errors if there's an Option Base 1 statement at
the top of the module.

On Tue, 26 Aug 2003 11:33:53 -0400, "Tom Ogilvy" wrote:

Private Sub Up1_Click()

Dim i as long, idex as long

Dim rngSource as Range, rngDest as Range

Dim sName as String

Dim varr as variant, varr1 as variant
idex = LB1.ListIndex+1

SName = "QA"&idex
Range("C5").Value = Worksheets(sName).Range("B4").Value
Range("C6").Value = Worksheets(sName).Range("E4").Value
varr = Array(13,14,31,49,78,96,114)

varr1 = Array(6,9,11,12,13,14,16)

for i = 0 to 7

set rngSource = worksheets(sName).Cells(varr1(i),4).Resize(1,12)

set rngDest = Cells(varr(i),3).Resize(1,12)

rngDest.Value = rngSource.value

Next

End Sub



Should be a little more manageable.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Splitting a Procedure

Thanks for the typo correction. I usually use Lbound and Ubound as well.

Regards,
Tom Ogilvy


"Myrna Larson" wrote in message
...
Typo, Tom. Should be

For i = 0 To 6

not 7. But I prefer Lbound and UBound, to avoid errors if there's an

Option Base 1 statement at
the top of the module.

On Tue, 26 Aug 2003 11:33:53 -0400, "Tom Ogilvy" wrote:

Private Sub Up1_Click()

Dim i as long, idex as long

Dim rngSource as Range, rngDest as Range

Dim sName as String

Dim varr as variant, varr1 as variant
idex = LB1.ListIndex+1

SName = "QA"&idex
Range("C5").Value = Worksheets(sName).Range("B4").Value
Range("C6").Value = Worksheets(sName).Range("E4").Value
varr = Array(13,14,31,49,78,96,114)

varr1 = Array(6,9,11,12,13,14,16)

for i = 0 to 7

set rngSource = worksheets(sName).Cells(varr1(i),4).Resize(1,12)

set rngDest = Cells(varr(i),3).Resize(1,12)

rngDest.Value = rngSource.value

Next

End Sub



Should be a little more manageable.




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
Stop a Procedure from another procedure Ayo Excel Discussion (Misc queries) 1 October 30th 08 01:42 AM
Procedure is too big Frank Situmorang Excel Worksheet Functions 2 May 2nd 07 05:06 AM
VBA Procedure Jeff Excel Discussion (Misc queries) 0 January 20th 06 04:22 PM
Splitting a Procedure John Wilson Excel Programming 0 August 26th 03 04:04 PM


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