Fixing a macro

  • Thread starter Thread starter Tim Dolan
  • Start date Start date
T

Tim Dolan

I've had a macro in place, that permitted me to
print a group of columns.
Over a period of time, comments were added to my spread sheet (the little
red triangles in the corner)
Since then the macro will not work.
I've tried to remove all the macros. Maybe I haven't because I can't get the
macro to work.
Is a way that I can copy the macro and the error message for you to see so
it may be repaired.
As you can probably tell, I don't know how to make a macro.
Thanks,
Tim fm CT
 
If you want to remove the code, make a trip to Debra Dalgleish's site:
http://www.contextures.com/xlfaqMac.html#NoMacros

In fact, if you want to try to fix the macro, you can visit Deb's site to find
out where it's stored.

Then you can copy|paste that code into a message and post back. (Don't attach
workbooks.)

Maybe you'll be able to get some help.
 
Thanks Dave,
I went to the site. Wow! I'm way over my head. A person
I met on line made the macro for me. Then later on another person helped me
improve the stats sheet. That's when the macro started giving me error
messages. The spread sheet person uses macs and was not familiar with excel
macros. I can't seem to contact my original macro person.
Everything seems to be ok, IE: a input box asks me for the week to print.
But then whatever I insert it get a
run-time error 424
object required.
if I click on "degug" it goes to a dos looking screen.
If I click "end" I can go back to where I was, but no macro action.
That's it, Help me if you can...
Tim fm CT
 
Copy and paste the code from that DOS looking screen into your next message.

I'm sure someone will jump in.
 
Thanks Dave,
Here is the code of the macro that I'm trying to fix::
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
Tim fm CT
 
I think that the bad news is I'm not sure what your procedure should do.

I made some changes that appear (to me) to be ok guesses, but I really don't
know:

Option Explicit
Sub PrintOut()
Dim myWeek As Range
Dim myRange As Range

With ActiveSheet

' .Unprotect
Set myWeek = Nothing
On Error Resume Next
Set myWeek = Application.InputBox _
(prompt:="Select the week number to print", _
Type:=8).Cells(1)
On Error GoTo 0

If myWeek Is Nothing Then
'user hit cancel
Exit Sub
End If

Set myRange = Range(myWeek.Offset(0, 6), _
myWeek.SpecialCells(xlLastCell))

myRange.EntireColumn.Hidden = True
If myRange.Column <> 10 Then
Range(myRange.Offset(0, -1), .Cells(3, 10)) _
.EntireColumn.Hidden = True
End If
.PrintPreview
' .PrintOut
.Cells.EntireColumn.Hidden = False
.Protect
End With
End Sub

If this isn't close, you may want to post back with what you want the procedure
to do (and a little about how your data is laid out).
 
Ok, sorry I didn't tell you more.
It's a stats sheet that I use for a Seniors Daytime 8-ball league.
page one is the input or data page and page two is the summary.
The macro permitted me to print just the previous weeks scores etc.
I don't mind sending you the whole thing, I would like to streamline it for
the seniors but of course, I don't know hoe to do that either. I've tried
many times to do stuff myself. Fortunately, I've learned to not save
changes. <VBG>
So maybe I should wait. In case you'd like to see the whole
thing.
Tim fm CT
 
I don't like opening workbooks of unknown origin. Just an antivirus/antiworm
rule of mine.

If you describe what the macro should do in more detail, there are lots of
people who can help.

Kind of like:

I get asked to select a range.
I select a range.
Using the top left cell of that range, print everything before that column to
everything up to and including 6 columns to the right. (And xx number of rows.)



Tim said:
Ok, sorry I didn't tell you more.
It's a stats sheet that I use for a Seniors Daytime 8-ball league.
page one is the input or data page and page two is the summary.
The macro permitted me to print just the previous weeks scores etc.
I don't mind sending you the whole thing, I would like to streamline it for
the seniors but of course, I don't know hoe to do that either. I've tried
many times to do stuff myself. Fortunately, I've learned to not save
changes. <VBG>
So maybe I should wait. In case you'd like to see the whole
thing.
Tim fm CT
 
Thanks Dave,
I don't know what more to say to describe the macro.
I keep track of each player's stats each week. Then I print the summary page
with all the teams and players stats. (matches played, games played, number
of balls made, team standing etc.)
Originally, there was a macro that would print the previous weeks stats if I
entered the week number in the box that appeared when I clicked on the
macro.
That's all I know how to describe. It's not a big deal. It's always been
hard for me to get replies when I ask about billiards stuff. Interestingly,
I received my first assistance, a few years ago, when I changed my
question to baseball averages.
Thanks again for your efforts. You are the only one that replied.
 
The macro you posted didn't ask you to type in a week number. It asked you to
point at a range (maybe a cell that contained the week number???).

If it's a different macro (you'll have to look again), you'll have to post that
version.

If it's the same macro, you're still going to have to post those details. If
you did the printing manually, you'd have to know what you wanted.

Just keep track of that, type it up and post it here.

(Sometimes, only one person will respond when messages are kind of vague--but
others are just waiting for enough details to jump in and help.)



Tim said:
Thanks Dave,
I don't know what more to say to describe the macro.
I keep track of each player's stats each week. Then I print the summary page
with all the teams and players stats. (matches played, games played, number
of balls made, team standing etc.)
Originally, there was a macro that would print the previous weeks stats if I
entered the week number in the box that appeared when I clicked on the
macro.
That's all I know how to describe. It's not a big deal. It's always been
hard for me to get replies when I ask about billiards stuff. Interestingly,
I received my first assistance, a few years ago, when I changed my
question to baseball averages.
Thanks again for your efforts. You are the only one that replied.
 
Hi Dave,
I didn't write the macro. That's why I don't know much about
it. I can tell you that I was told that in excel there was a problem (bug
maybe) that "comments" (the little red triangles in the corner) cause macros
to fail.
I do remember putting in a cell number, but that doesn't work since the
comments were added.
BTW, thanks for being so patient with me.
 
You really don't need to know how a macro is written to describe what you want
one to do. Heck, a lot of developers would be out in the cold if everyone could
write their own code.

But if you think it's the comments that are causing the trouble, make a copy of
your workbook, remove the comments and see if that fixes it.



Tim said:
Hi Dave,
I didn't write the macro. That's why I don't know much about
it. I can tell you that I was told that in excel there was a problem (bug
maybe) that "comments" (the little red triangles in the corner) cause macros
to fail.
I do remember putting in a cell number, but that doesn't work since the
comments were added.
BTW, thanks for being so patient with me.
 
Dave,
I thought I did remove the comments. However, when I brought the
spreadsheet over to use it in a web site, I saw the red descriptions on the
bottom of the page. I can not find the red descriptions on the actual
spreadsheets.
 
I'm not sure what that means.

But you could select all the cells, then Edit|clear|comments
to test it again.

Tim said:
Dave,
I thought I did remove the comments. However, when I brought the
spreadsheet over to use it in a web site, I saw the red descriptions on the
bottom of the page. I can not find the red descriptions on the actual
spreadsheets.
 
Back
Top