Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Stop a Procedure from another procedure | Excel Discussion (Misc queries) | |||
Procedure is too big | Excel Worksheet Functions | |||
VBA Procedure | Excel Discussion (Misc queries) | |||
Splitting a Procedure | Excel Programming |