macro not working

T

Tim fm ct

I've contacted this group before but was unable to folow through.
I have a macro on a spreadsheet made on excel 2000.
I have a virus protection program. Is there any way I can send my
spreadsheet to someone and have the macro fixed?
Thanks in advance,
Tim fm CT
 
L

L. Howard Kittle

Hi Tim,

Post your code here, lots of folks will take a look at it. Probably don't
need the workbook, but sometimes it comes to that.

Regards,
Howard
 
O

Otto Moehrbach

As Howard said, post your macro. But also provide a blow-by-blow of what
the macro is supposed to do. Then provide information on what the macro
actually does. For instance, do you get an error? If so, what is the
error? When you get the error, and click on the Debug button in the error
message box, what line of your macro do you see highlighted?
If you don't get an error, what do you get? HTH Otto
 
T

Tim Dolan

Hi.
The macro is to print previous weeks data. When I activate the macro, it
askes for the week. No matter waht week I select I get an error.
When I select debug It shows the info below with the line that starts with
"set my range" highlited in yellow.. thanks for your reply.
Tim fm CT



Sub PrintOut()
' ActiveSheet.Unprotect
Set myWeek = Application.InputBox("Select the week number to print", , ,
, , , , 8)
Set myRange = Range(myRange.Offset(0, 6),
myRange.SpecialCells(xlLastCell)).EntireColumn.Hidden = True
If myRange.Column <> 10 Then
Range(myRange.Offset(0, -1), Cells(3, 10)).EntireColumn.Hidden = True
End If
ActiveSheet.PrintPreview
' ActiveSheet.PrintOut
Cells.EntireColumn.Hidden = False
ActiveSheet.Protect
End Sub

Sub PrintStandings()
ActiveSheet.PageSetup.PrintArea = Range("LeagueStandings").Address
' ActiveSheet.PrintPreview
ActiveSheet.PrintOut
End Sub

Sub PrintTopRank()
ActiveSheet.PageSetup.PrintArea = Range("TopRank").Address
' ActiveSheet.PrintPreview
ActiveSheet.PrintOut
End Sub

Sub PrintWeeklyResults()
ActiveSheet.PageSetup.PrintArea = Range("WeeklyResults").Address
ActiveSheet.PrintPreview
' ActiveSheet.PrintOut
End Sub
 
J

Joerg

Haven't looked at the rest of your code, but it's clear why you get this
error.

Look at the right side of the equation in your line Set myRange =
Range(myRange.Offset(0, 6)...
You use myRange, though it hasn't been defined yet. Use a range that has
been defined (a name different from 'myRange' would be preferable).

Joerg Mochikun
 
D

Don Guillett

Besides no range being set, I'm confused. Why don't you tell us what you are
trying to do.
BTW You do NOT have to set a print area to print a range

Sub PrintTopRank()
ActiveSheet.PageSetup.PrintArea = Range("TopRank").Address
ActiveSheet.PrintPreview
ActiveSheet.PrintOut
End Sub

Can be this and it does NOT have to be the active sheet.
Sub PrintTopRank()
Range("TopRank").PrintPreview
End Sub
 
Top