Excel Macro Problem!?

H

hbp78

Hey Guys/Girls,

I'm trying to create a Macro that takes weekly data for a months tim
frame and creates averages for trend tracking. The end result would b
a graph for a visual presentation. The macro is almost complete
however, the macro I made has to adjust for future month "structures
(i.e. 4 or 5 weeks in a month). The macro built was based on a 5 wee
month, yet when I run the macro with a 4 weeks worth of data it get'
caught up on the 5th week because it's blank.

Is there a way to say if worksheet "x" is blank skip the followin
steps in the macro. The work sheet with data has been included and th
run funtion is (Ctrl+ E).

'Link' (http://www.iamhetero.com/fun/Monthly Average.xls)

Also, is there a way when copying information after it's bee
subtotalled to pasted it without the hidden information?

Thanks for all your help,

Kevi
 
B

Bob Phillips

Why not just put a code in a cell when there is no week 5, and check that in
the VBA?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
H

hbp78

I'm sorry...I'm actually pretty new to macros and barely know code.
Could you possibly provide an example? :
 
B

Bob Phillips

Kevin,

I am not too conversant with you spreadsheet, and how you determine whether
the month has 4 or 5 weeks, but assuming you have some readily identifiable
rule for that, you could use that rule to populate cell A1 say with TRUE or
FALSE and then test like

For i = 1 To 5
If Worksheets(i).Range("A1").Value = TRUE Then
'rest of your code
End If
Next i

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top