ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Macro Problem!? (https://www.excelbanter.com/excel-programming/301677-excel-macro-problem.html)

hbp78

Excel Macro Problem!?
 
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

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Excel Macro Problem!?
 
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)

"hbp78 " wrote in message
...
Hey Guys/Girls,

I'm trying to create a Macro that takes weekly data for a months time
frame and creates averages for trend tracking. The end result would be
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 week
month, yet when I run the macro with a 4 weeks worth of data it get's
caught up on the 5th week because it's blank.

Is there a way to say if worksheet "x" is blank skip the following
steps in the macro. The work sheet with data has been included and the
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 been
subtotalled to pasted it without the hidden information?

Thanks for all your help,

Kevin


---
Message posted from http://www.ExcelForum.com/




hbp78[_2_]

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

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Excel Macro Problem!?
 
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)

"hbp78 " wrote in message
...
I'm sorry...I'm actually pretty new to macros and barely know code.
Could you possibly provide an example? :(


---
Message posted from http://www.ExcelForum.com/




hbp78[_3_]

Excel Macro Problem!?
 
Bob...Thank you so much it worked perfect

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 12:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com