ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Some VBA questions about cell selection (https://www.excelbanter.com/excel-programming/289934-some-vba-questions-about-cell-selection.html)

JasonSelf[_7_]

Some VBA questions about cell selection
 
Believe it or not, I am actually trying to write this VBA for my mother.
She does attendance forms for her school each week and after she is
done has to write some formulas in...unfortunately she is less adept at
excell formulas and usage than I am with VBA. So here is what I am
trying to accomplish.

1. I need to some how have excell figure out what the last used row in
column A is, skip a column and then write in a formula....I can write
in the forumla just not the other stuff.

2. On that same row I need it to verify what is in row 2 of any given
column and based on that value return a forumla to that cell.

This is probably easy for most of you but I am just learning so bear
with me.

Thanks,
Jason Self


---
Message posted from http://www.ExcelForum.com/


John Wilson

Some VBA questions about cell selection
 
Jason,

I think you're mixing up rows and columns in your post???

range("A" & rows.Count).End(xlUp).row + 1

will get you the row number of the first empty cell in
Column "A", after the last cell (in Column "A") with
an entry in it.

Post back with more info on what you're trying to do.

John

"JasonSelf " wrote in message
...
Believe it or not, I am actually trying to write this VBA for my mother.
She does attendance forms for her school each week and after she is
done has to write some formulas in...unfortunately she is less adept at
excell formulas and usage than I am with VBA. So here is what I am
trying to accomplish.

1. I need to some how have excell figure out what the last used row in
column A is, skip a column and then write in a formula....I can write
in the forumla just not the other stuff.

2. On that same row I need it to verify what is in row 2 of any given
column and based on that value return a forumla to that cell.

This is probably easy for most of you but I am just learning so bear
with me.

Thanks,
Jason Self


---
Message posted from http://www.ExcelForum.com/




Bob Phillips[_6_]

Some VBA questions about cell selection
 
Jason,

1. The cell in question can be referenced with

Range("A" &
Cells(Rows.Count,"A").End(xlUp).Row+1).Offset(0,1) .FormulaR1C1 = etc.

2. To validate a cell of (I assume you mean) column 2

I suggest you set an object variab le to your current cell, such as

set thisCell = Range("A" &
Cells(Rows.Count,"A").End(xlUp).Row+1).Offset(0,1)
If Cells(thisCell.Row,2) = "abc" Then 'as an example
thisCell.FormulaR1C1 = "=RC2& "" is the answer"""
Endif

This simply tests the value in column 2, and if it is 'abc' returns the
text in the current cell.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"JasonSelf " wrote in message
...
Believe it or not, I am actually trying to write this VBA for my mother.
She does attendance forms for her school each week and after she is
done has to write some formulas in...unfortunately she is less adept at
excell formulas and usage than I am with VBA. So here is what I am
trying to accomplish.

1. I need to some how have excell figure out what the last used row in
column A is, skip a column and then write in a formula....I can write
in the forumla just not the other stuff.

2. On that same row I need it to verify what is in row 2 of any given
column and based on that value return a forumla to that cell.

This is probably easy for most of you but I am just learning so bear
with me.

Thanks,
Jason Self


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 03:00 PM.

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