ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macros (https://www.excelbanter.com/excel-discussion-misc-queries/70361-macros.html)

Steph

Macros
 
I am writing a macros program and am having trouble with a formula.

If I have a set of values in column A and would like to use those values in
column B with a formula, is there a command that will fill column B with that
formula?

The number of data points I use is always different so I can not tell excel
to fill column B up to row 60 because it is not always 60 points.

I've tried this with no success.....
Range(ActiveCell.End(x2Down)).Select

Don Guillett

Macros
 
try
cells(rows.count,activecell.column).end(xlup).row
or specify the column

lastrow=cells(rows.count,"a").end(xlup).row
set


NO need to select anything
sub setformula()
Set frng = Range("a8:a" & cells(rows.count,"a").End(xlUp).Row)
With frng
.Formula = "=a7+3
' .Formula = .Value 'to erase the formulas and leave the values
End With
End Sub

--
Don Guillett
SalesAid Software

"Steph" wrote in message
...
I am writing a macros program and am having trouble with a formula.

If I have a set of values in column A and would like to use those values
in
column B with a formula, is there a command that will fill column B with
that
formula?

The number of data points I use is always different so I can not tell
excel
to fill column B up to row 60 because it is not always 60 points.

I've tried this with no success.....
Range(ActiveCell.End(x2Down)).Select




Steph

Macros
 

As a very inexperienced macro writer I am very confused. I have been
teaching myself macros from a book.

Maybe you can be more specific if I am more specific....
The formula I am using is as follows:
"(RC[-1]-Sheet2!R2C11)*86400"
I am converting time in my data.

My data is in column k. I wish to do the convesion in column L.


Thanks for all the help!

"Don Guillett" wrote:

try
cells(rows.count,activecell.column).end(xlup).row
or specify the column

lastrow=cells(rows.count,"a").end(xlup).row
set


NO need to select anything
sub setformula()
Set frng = Range("a8:a" & cells(rows.count,"a").End(xlUp).Row)
With frng
.Formula = "=a7+3
' .Formula = .Value 'to erase the formulas and leave the values
End With
End Sub

--
Don Guillett
SalesAid Software

"Steph" wrote in message
...
I am writing a macros program and am having trouble with a formula.

If I have a set of values in column A and would like to use those values
in
column B with a formula, is there a command that will fill column B with
that
formula?

The number of data points I use is always different so I can not tell
excel
to fill column B up to row 60 because it is not always 60 points.

I've tried this with no success.....
Range(ActiveCell.End(x2Down)).Select






All times are GMT +1. The time now is 11:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com