macro not working

  • Thread starter Thread starter Tim fm ct
  • Start date Start date
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
 
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
 
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
 
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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Spurious macro warnings 11
Macro Stoped Working 2
Fixing a macro 13
Help 2
excel 2000 question 7
Excel Macro Help 1
Macro to insert a line when a value changes in a range 1
Help with macro please 3

Back
Top