![]() |
Identify Current Row for ActiveCell
I am in need of a sample VB code for Excel that will allow me to identify the
current row for the ActiveCell. Once I have the active row - I will "Selection.ClearContents" the entire row. Thanks for any help you can provide. -- Regards Mark H |
Identify Current Row for ActiveCell
Why select...
ActiveCell.EntireRow.ClearContents HTH "COL H" wrote: I am in need of a sample VB code for Excel that will allow me to identify the current row for the ActiveCell. Once I have the active row - I will "Selection.ClearContents" the entire row. Thanks for any help you can provide. -- Regards Mark H |
Identify Current Row for ActiveCell
Range("a2").Select
MsgBox ActiveCell.Row Selection.EntireRow.ClearContents HTH "COL H" wrote: I am in need of a sample VB code for Excel that will allow me to identify the current row for the ActiveCell. Once I have the active row - I will "Selection.ClearContents" the entire row. Thanks for any help you can provide. -- Regards Mark H |
Identify Current Row for ActiveCell
If the current selection includes more than one row (your code is selecting a
single cell so not a problem), then your code will clear the contents of more than just the activecell row. This could be what COL H wants but it is not what was asked for... Up to COL H to decide. HTH "Toppers" wrote: Range("a2").Select MsgBox ActiveCell.Row Selection.EntireRow.ClearContents HTH "COL H" wrote: I am in need of a sample VB code for Excel that will allow me to identify the current row for the ActiveCell. Once I have the active row - I will "Selection.ClearContents" the entire row. Thanks for any help you can provide. -- Regards Mark H |
Identify Current Row for ActiveCell
Jim,
Agreed. I used the the sample to illustrate how one could get the row number. I accept using your solution is "more" correct but one day he might one the row number ...!. "Jim Thomlinson" wrote: If the current selection includes more than one row (your code is selecting a single cell so not a problem), then your code will clear the contents of more than just the activecell row. This could be what COL H wants but it is not what was asked for... Up to COL H to decide. HTH "Toppers" wrote: Range("a2").Select MsgBox ActiveCell.Row Selection.EntireRow.ClearContents HTH "COL H" wrote: I am in need of a sample VB code for Excel that will allow me to identify the current row for the ActiveCell. Once I have the active row - I will "Selection.ClearContents" the entire row. Thanks for any help you can provide. -- Regards Mark H |
Identify Current Row for ActiveCell
I wouldn't say more correct. Gosh only knows if your code is what is actually
wanted or mine. I have seen your code and the distinction between the selection and the acitve cell is not lost on you. It is however a subtlety that is lost on many. It took me a while to fully appreciate it... But I can be a little slow... Between the two of us we have answered this question from all angles... :-) "Toppers" wrote: Jim, Agreed. I used the the sample to illustrate how one could get the row number. I accept using your solution is "more" correct but one day he might one the row number ...!. "Jim Thomlinson" wrote: If the current selection includes more than one row (your code is selecting a single cell so not a problem), then your code will clear the contents of more than just the activecell row. This could be what COL H wants but it is not what was asked for... Up to COL H to decide. HTH "Toppers" wrote: Range("a2").Select MsgBox ActiveCell.Row Selection.EntireRow.ClearContents HTH "COL H" wrote: I am in need of a sample VB code for Excel that will allow me to identify the current row for the ActiveCell. Once I have the active row - I will "Selection.ClearContents" the entire row. Thanks for any help you can provide. -- Regards Mark H |
Identify Current Row for ActiveCell
May I ask why the ActiveCell row? I wonder if you could explain your
process; I'll wager to bet we could come up with a better/efficient solution to fit your needs. -- Regards, Zack Barresse, aka firefytr "COL H" wrote in message ... I am in need of a sample VB code for Excel that will allow me to identify the current row for the ActiveCell. Once I have the active row - I will "Selection.ClearContents" the entire row. Thanks for any help you can provide. -- Regards Mark H |
All times are GMT +1. The time now is 10:01 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com