Hello Rene
A good start is to use the macro recorder.
First customise your toolbar by adding the icon called "button" (comes under Forms and looks like an oblong grey button).
If you click on this icon it will display a small cross. Move this cross to your worksheet and drag it to produce a button. A dialogue box will open.
Select Record, then name your macro.
Everything you do on your worksheet from now on is being recorded, so try a few things, then stop recording. (sometimes you get a little stop icon floating on your worksheet, but if not, go to Tools, Macro, Stop Recording). It is very important to stop recording, it can be easy to forget.
Now, when you click this button it will repeat everything you just recorded.
Select Shift+F11 to go to the Visual Basic Editor to examine your code. This is a good way to start learning how code is put together and to experiment by changing things and testing the result. Shift+F11 will take you back to your worksheet. To format your button right mouse click it (selecting edit takes you to the macro code for this button again)
I have looked for some simple books on macro language but I find most quite difficult to follow, but by playing with the macro recorder and picking up tips at this site you will soon be able to do a lot of useful things
Good luck
Derek
I know how to record the macro, but now i want to do something more advanced. I want to select an area (a1:d4) and cut all the rows where A has a value of 25. Then paste them in another sheet.
Is this at all possible to give the selection an IF in the macro?
I need to learn how to make a Macro, take information from one worksheet to another, but i need the cell it pasts the info in, to change everytime
Yeah, you can use an IF statement. just edit the macro, then use the syntax:
IF Worksheets("worksheetname") > cells(r,c)=25 Then
copy and paste and whatever else
Endif
r = row and c = column of the cell you want to look at.
Hi Rene,
This is just simple:
Under Command Button1:
Place this procedure:
Private Sub CommandButton1_Click()
Dim PRINT
Application.Run "PRINT"
End Sub
Make these as a macro say saveas PRINT macro:
Sheets("Sheet1").Activate
Range("A4:K100").Select
ActiveSheet.PageSetup.PrintArea = "$A$4:$K$100"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True, Collate:= _True
Hope this help a bit.
Regards,
Mel Arquiza
Home Page Design