Merging VBA

iluvfnky

New Member
Joined
Oct 20, 2010
Messages
47
Hi,

I need to merge these two to run under the same code but i'm not sure...

Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = False
With Range("A6")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
Exit For
End If
Next oPic
End With
End Sub


And

Private Sub Worksheet_Calculate()
With Range("I3")
ActiveSheet.Shapes("LINEG").Visible = IIf(Len(.Value) = 0 Or .Value = 0, False, True)
End With
End Sub

Anyone help? Many Thanks...
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try...

Code:
[font=Verdana][color=darkblue]Option[/color] [color=darkblue]Explicit[/color]

[color=darkblue]Private[/color] [color=darkblue]Sub[/color] Worksheet_Calculate()
    [color=darkblue]Dim[/color] oPic [color=darkblue]As[/color] Picture
    Me.Pictures.Visible = [color=darkblue]False[/color]
    [color=darkblue]With[/color] Range("A6")
        [color=darkblue]For[/color] [color=darkblue]Each[/color] oPic [color=darkblue]In[/color] Me.Pictures
            [color=darkblue]If[/color] oPic.Name = .Text [color=darkblue]Then[/color]
                oPic.Visible = [color=darkblue]True[/color]
                oPic.Top = .Top
                oPic.Left = .Left
                [color=darkblue]Exit[/color] [color=darkblue]For[/color]
            [color=darkblue]End[/color] [color=darkblue]If[/color]
        [color=darkblue]Next[/color] oPic
    [color=darkblue]End[/color] [color=darkblue]With[/color]
    [color=darkblue]With[/color] Range("I3")
        Me.Shapes("LINEG").Visible = IIf(Len(.Value) = 0 [color=darkblue]Or[/color] .Value = 0, [color=darkblue]False[/color], [color=darkblue]True[/color])
    [color=darkblue]End[/color] With
End [color=darkblue]Sub[/color]
[/font]
 
Upvote 0

Forum statistics

Threads
1,224,612
Messages
6,179,890
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top