Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

Excel Macro help

Aug 30, 2005 5:32AM PDT

I am a A-Level ICT Vce student and basically my teacher is very very crap. I have been set this assignment over the holidays which no one in my class understand becasue we havent had anything explained to us but when i told him no one understood marcro, he just did the first bit for me. I now how to finish it but dont have a clue what he has done.

What as far as i know we have to do is, to have one sheet in excel with a layout of one collum containing words such as "gas, electricity, water tv" and next to it, a seperate collum for the months going from january to december. In the spaces underneath the months needs to be some figures of money for how much they cost each month. underneath this, for each month needs to be an "UPDATE" macro button which updates these figures onto another sheet to record these figures. Here is the coding my teacher used for febuary in the first sheet:

Sub update()
MsgBox "macro running"
If Sheet2.Range("b1").Value = "January" Then
MsgBox "january"
Sheet3.Range("B3:b6").Value = Sheet2.Range("b2:b5").Value
ElseIf Sheet2.Range("b1").Value = "February" Then
MsgBox "february"
Sheet3.Range("c3:c6").Value = Sheet2.Range("b2:b5").Value
End If


End Sub

I have to do the same kind of coding for each of the months but i dont know how to create a macro button for a start. Ahh its all too confusing! But i wish i actually got taught something.

Thank you!

Anneka

Discussion is locked

- Collapse -
Excel Macro help
Aug 30, 2005 5:35AM PDT

And just to let you know i was using Visual basic Editor....Basic!?? Its harrrd!

- Collapse -
Re: macro's
Aug 30, 2005 8:38AM PDT

Callipygian,

I agree, Basic was basic when it was invented back in 1960. And practically unchanged when Microsoft started with GWBasic (came with DOS 2.1). An example you surely understand:

10 PRINT "HELLO WORLD"
RUN

But it became visual and object oriented and started to use all those environment-dependent methods and properties. Indeed, it takes some time to learn.

One of the unwritten policies on these forums is that we unanimously find that a student has to learn the trade by hard and time-consuming study himself. That's the way we did it ourselves and by far the best way also. Learning by doing and trial and error. So nobody here will do your homework for you, I'm afraid.

Nobody, by the way, will help you when you have to learn a new computer language in 2010 and 2020 and 2030, so you better learn to learn now. That's important if you pursue an ICT-career.

Go to the library or a bookshop, if the course material doesn't provide you with enough information, and find the generally excellent Microsoft help files insufficient and can't find what you need on Google either. And try and try and try ...


Kees

- Collapse -
Kees is right
Sep 1, 2005 4:10AM PDT

You are going to class to learn, and having someone else do your homework doesn't help you learn.

While the VGA Help is better than most from Microsoft, sometimes it is ambiguous, and someties it assumes the user has some degree of knowledge of the subject. All I will tell you is that some books in my library that provide a lot of information on the subject are:

Walkenbach, John, "Excel 200 Power Programming with VBA," Hungry Minds, Inc.

Kofler, Michael, "Definitive Guide to Excel VGA, 2nd edition," Apress.

Boonin ,Elizabeth, "Using Excel Visual Basic for Applications", Que

The first two are quite comprehensive, but are not easy reads. The third is at an easier level, but does not cover everything.

There are, of course, many other books on the subject, so follow Kees' advice and check them out.

Hope this helps

Frank

- Collapse -
Macro help
Sep 4, 2005 5:49AM PDT

Yeah i guess your right, i will check out some books to do this and maybe give some to my actual teacher and see if he will learn anything from that lol. I wasnt getting people to tell me or do my work for me, i just needed someone to show me the dirrection in which i would need to go about doing this. I was mostly stuck on the first part which was inputing an actual macro button into my spreadsheet to which i can then write a macro code to that based on my first code which i was shown.

Thanks for helping anyway.

Anneka

- Collapse -
Re: macro help.
Sep 4, 2005 7:19AM PDT

Anneka,

In fact, I made a spreadsheet last year with a button and a macro assigned to it.

But I had to find out how to do it in the Help. And to provide you with the answer now, I should have to redo the discovery search all over again. Somehow, how to do things (including VBA) in Access stays current with me (except using recordsets), while I practically immediately forget the details of how to program in Excel, including things like adding a button to a worksheet (it's really easy once you've found it out!). And I suppose (but it's just an supposition right now) that the macro to be called is defined in its properties.

And I'm sure you can read the Help just as well as I can. Or google excel button macro.

Good luck,


Kees

- Collapse -
Re: macro help (2)
Sep 4, 2005 5:11PM PDT

Anneka,

While following my own google search to refresh my knowledge, I discovered there are kinds of buttons in Excel to attach a macro to:
1. A (new) button on the toolbar
2. A button you draw on a worksheet.

The instructions to do it are quite different, and you didn't specify which of the two you intended to use.

Hope this helps.


Kees

- Collapse -
ahh haa
Sep 7, 2005 4:12AM PDT

ooh i found out how to do it now! yey! It took me this long, and its only a few clicks away. Right now maybe i can try and figure the rest of it out lol. Well thanks to you guys for helping me out anyways.

Anneka