Thanks:  0
Likes:  0

1. Hey!
I'm v.new to macros & the like so i need some advise.
I have a task i need to automate as I seem to have to do it manually 10 times a day.
I just need help with the principle really - so, hypothetically, if i was recording a macro to just multiply cell A1*B1 in cell C1,; I could have a file that has just 5 rows with A & B values, but other files may has 20,0000 A & B values.
What is the most efficient way to do this so after the macro runs I have no tidying up to do? - i say this as the way i would do it at the moment is to copy cell C1 through to C65536, and when i get a file with just 6 rows i have to clear the remaining 65531 cells!

2. put this in c1 then fill down

this will check if the a1 or b1 is empty if so it will make c1 empty
if a1 and b1 have number in them then it will multiply them

=IF(OR(A1="",B1=""),"",A1*B1)

3. On 2002-05-03 01:11, Saddler wrote:
Hey!
I'm v.new to macros & the like so i need some advise.
I have a task i need to automate as I seem to have to do it manually 10 times a day.
I just need help with the principle really - so, hypothetically, if i was recording a macro to just multiply cell A1*B1 in cell C1,; I could have a file that has just 5 rows with A & B values, but other files may has 20,0000 A & B values.
What is the most efficient way to do this so after the macro runs I have no tidying up to do? - i say this as the way i would do it at the moment is to copy cell C1 through to C65536, and when i get a file with just 6 rows i have to clear the remaining 65531 cells!
Have a look @ the following;
```
Sub Tester()

[C1].FormulaR1C1 = "=RC[-2]*RC[-1]"
[C1].AutoFill Destination:=Range("C1:C" & [A1].End(xlDown).Row)

End Sub
```

Assumes
1) Data starts in A1 & B1
2) No gaps in data columns

This places the formula =A1*B1 in C1
(Using R1C1 format)
Gets last Row from the VBA use of End(Xldown)
The equavalent Keyboard command is
Selecting a cell and pressing END then the
arrow key...this takes you to the Last populated cell in the specified direction
which in this case is Down.

4. Cheers Chaps!

## User Tag List

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•