Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Compile Error: Procedure too Large Question

If my procedure is too large what can I do to make it work?

Thank you,

Daniel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Compile Error: Procedure too Large Question

Umm, make it smaller?




"Daniel R. Young" wrote in message
...
If my procedure is too large what can I do to make it work?

Thank you,

Daniel



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Compile Error: Procedure too Large Question

I cannot make it smaller. Here is the code:
If Target.Address = "$G$9748" Then
If Me.Range("G9748").Value = "Yes" Then
Application.Dialogs(xlDialogInsertPicture).Show
Selection.Height = Range("F9745:I9753").Height
Selection.Width = Range("F9745:I9753").Width
Selection.Top = Range("F9745:I9753").Top
Selection.Left = Range("F9745:I9753").Left
Selection.Placement = xlMoveAndSize
End If
End If
This is repeated 176 times with different values. Is there a way to make it
smaller?

"JM" wrote:

Umm, make it smaller?




"Daniel R. Young" wrote in message
...
If my procedure is too large what can I do to make it work?

Thank you,

Daniel




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Compile Error: Procedure too Large Question

Hi,
Consider holding the target address and corresponding ranges in a
table and using VLOOKUP or INDEX/MATCH. The code would only be a minor
modification to your code below.

VLOOKUP table would be of format

Target Address Data Range
$G$9748 F9745:I9753


HTH

"Daniel R. Young" wrote:

I cannot make it smaller. Here is the code:
If Target.Address = "$G$9748" Then
If Me.Range("G9748").Value = "Yes" Then
Application.Dialogs(xlDialogInsertPicture).Show
Selection.Height = Range("F9745:I9753").Height
Selection.Width = Range("F9745:I9753").Width
Selection.Top = Range("F9745:I9753").Top
Selection.Left = Range("F9745:I9753").Left
Selection.Placement = xlMoveAndSize
End If
End If
This is repeated 176 times with different values. Is there a way to make it
smaller?

"JM" wrote:

Umm, make it smaller?




"Daniel R. Young" wrote in message
...
If my procedure is too large what can I do to make it work?

Thank you,

Daniel




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Compile Error: Procedure too Large Question

Looks like you could only have such code appear one time and program a loop
that goes through the various cells and performs the relative action.

So you should be able to make it smaller. If not, then break it into two
macros. Half the code in one module (88 cells worth) and half the code in
another module (88 cells worth). then you can use a tiny macro to call both

Sub Master()
Macro1
Macro2
End Sub


--
Regards,
Tom Ogilvy

"Daniel R. Young" wrote in message
...
I cannot make it smaller. Here is the code:
If Target.Address = "$G$9748" Then
If Me.Range("G9748").Value = "Yes" Then
Application.Dialogs(xlDialogInsertPicture).Show
Selection.Height = Range("F9745:I9753").Height
Selection.Width = Range("F9745:I9753").Width
Selection.Top = Range("F9745:I9753").Top
Selection.Left = Range("F9745:I9753").Left
Selection.Placement = xlMoveAndSize
End If
End If
This is repeated 176 times with different values. Is there a way to make

it
smaller?

"JM" wrote:

Umm, make it smaller?




"Daniel R. Young" wrote in

message
...
If my procedure is too large what can I do to make it work?

Thank you,

Daniel








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Compile Error: Procedure too Large Question

I am very new at this. Can you help me a little be more?

Thank you,
dAn

"Toppers" wrote:

Hi,
Consider holding the target address and corresponding ranges in a
table and using VLOOKUP or INDEX/MATCH. The code would only be a minor
modification to your code below.

VLOOKUP table would be of format

Target Address Data Range
$G$9748 F9745:I9753


HTH

"Daniel R. Young" wrote:

I cannot make it smaller. Here is the code:
If Target.Address = "$G$9748" Then
If Me.Range("G9748").Value = "Yes" Then
Application.Dialogs(xlDialogInsertPicture).Show
Selection.Height = Range("F9745:I9753").Height
Selection.Width = Range("F9745:I9753").Width
Selection.Top = Range("F9745:I9753").Top
Selection.Left = Range("F9745:I9753").Left
Selection.Placement = xlMoveAndSize
End If
End If
This is repeated 176 times with different values. Is there a way to make it
smaller?

"JM" wrote:

Umm, make it smaller?




"Daniel R. Young" wrote in message
...
If my procedure is too large what can I do to make it work?

Thank you,

Daniel



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Compile Error: Procedure too Large Question

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.count 1 then exit sub
If Target.Column = 7 then
if Target.Value = "Yes" then
set rng = Target.Offset(-3,-1).Resize(8,4)
Application.Dialogs(xlDialogInsertPicture).Show
Selection.Height = rng.Height
Selection.Width = rng.Width
Selection.Top = rng.Top
Selection.Left = rng.Left
Selection.Placement = xlMoveAndSize
End if
End if
End Sub

--
Regards,
Tom Ogilvy

"Daniel R. Young" wrote in message
...
I am very new at this. Can you help me a little be more?

Thank you,
dAn

"Toppers" wrote:

Hi,
Consider holding the target address and corresponding ranges in

a
table and using VLOOKUP or INDEX/MATCH. The code would only be a minor
modification to your code below.

VLOOKUP table would be of format

Target Address Data Range
$G$9748 F9745:I9753


HTH

"Daniel R. Young" wrote:

I cannot make it smaller. Here is the code:
If Target.Address = "$G$9748" Then
If Me.Range("G9748").Value = "Yes" Then
Application.Dialogs(xlDialogInsertPicture).Show
Selection.Height = Range("F9745:I9753").Height
Selection.Width = Range("F9745:I9753").Width
Selection.Top = Range("F9745:I9753").Top
Selection.Left = Range("F9745:I9753").Left
Selection.Placement = xlMoveAndSize
End If
End If
This is repeated 176 times with different values. Is there a way to

make it
smaller?

"JM" wrote:

Umm, make it smaller?




"Daniel R. Young" wrote in

message
...
If my procedure is too large what can I do to make it work?

Thank you,

Daniel





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
VBA Compile error: Procedure too large? Jerry Dyben Excel Discussion (Misc queries) 1 October 31st 05 10:15 PM
Compile error: Procedure too large Susan Hayes Excel Programming 2 May 20th 05 05:01 PM
function "compile error msg: procedure too large" RASHESH Excel Programming 4 May 13th 05 04:48 AM
Compile Error: Procedure too large mate Excel Programming 2 May 18th 04 04:30 PM
Compile Error: Procedure too long Excel-erate2004[_3_] Excel Programming 4 April 22nd 04 11:43 PM


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