gsinkinson
New Member
- Joined
- Nov 8, 2011
- Messages
- 5
Been away from Excel for a while and now trying to get re-started ...
I have a worksheet table with numbers that I want to add a column to,
perform a calculation for each row in the table and then convert the cell contents to values.
I will add more columns to the sheet for other calculations.
I can add a new column with this Sub:
I know I can add a name parameter, but I plan to use this Sub repeatedly
It generates the following:
I want to create a Sub for each different calculation that does the following:
1.renames the header of the new column - for example, 5th to Rng
2.adds a calculation to the first row of the new column - for example, 4th number minus 1st number
(the table will then replicate that calculation for all the cells in the new column)
3.changes the formula to a value in the new cells
Hopefully ending up with something like:
Here are my 3 questions relating to VBA and tables:
A. I'm not sure how to rename the table column header from 5th to Rng
B. I'm not sure how move down 1 row to the first data row and
add ActiveCell.Formula = "=D2-A2", but using column header names 4th and 1st.
C. I'm also not sure how to convert the cell formulas to values.
I hope to create a Sub for each one of the calculations, something like:
I used to know how to do this but I've lost my notes and examples.
I think the 95 degree room I'm in has fried my brains ...
I realize that the add and convert can be their own subs
and be called. I'm open to suggestions
I have a worksheet table with numbers that I want to add a column to,
perform a calculation for each row in the table and then convert the cell contents to values.
I will add more columns to the sheet for other calculations.
I can add a new column with this Sub:
I know I can add a name parameter, but I plan to use this Sub repeatedly
It generates the following:
I want to create a Sub for each different calculation that does the following:
1.renames the header of the new column - for example, 5th to Rng
2.adds a calculation to the first row of the new column - for example, 4th number minus 1st number
(the table will then replicate that calculation for all the cells in the new column)
3.changes the formula to a value in the new cells
Hopefully ending up with something like:
Here are my 3 questions relating to VBA and tables:
A. I'm not sure how to rename the table column header from 5th to Rng
B. I'm not sure how move down 1 row to the first data row and
add ActiveCell.Formula = "=D2-A2", but using column header names 4th and 1st.
C. I'm also not sure how to convert the cell formulas to values.
I hope to create a Sub for each one of the calculations, something like:
I used to know how to do this but I've lost my notes and examples.
I think the 95 degree room I'm in has fried my brains ...
I realize that the add and convert can be their own subs
and be called. I'm open to suggestions