ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How To: Macro Command To Reference Populated Cells Only (https://www.excelbanter.com/excel-programming/306112-how-macro-command-reference-populated-cells-only.html)

TJM[_2_]

How To: Macro Command To Reference Populated Cells Only
 
Is there a macro command line that I can use that will referenc
populated cells only?

My example: I have Column A populated. This may be cells A1 - A
(meaning A? = will vary). In column B, I have a macro command to ad
".

What I want to be able to do is this: run my macro and have it add th
" only those populated cells in column A.

Right now, I select cell B1 and type the formula ".
then manually copy and paste this formula to the remain cells in colum
B to the point where the cells are populated in column A. I'd like t
be able to automate this process via a macro.

Thanks!

TJ

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


Dave Peterson[_3_]

How To: Macro Command To Reference Populated Cells Only
 
option explicit
sub testme01()

dim wks as worksheet

set wks = activesheet
with wks
with .range("a1",.cells(.rows.count,"A").end(xlup)).off set(0,1)
.formula = """
.value = .value
end with
end with
end sub

This'll do it from A1 to the last used cell in column A.

"TJM <" wrote:

Is there a macro command line that I can use that will reference
populated cells only?

My example: I have Column A populated. This may be cells A1 - A?
(meaning A? = will vary). In column B, I have a macro command to add
".

What I want to be able to do is this: run my macro and have it add the
" only those populated cells in column A.

Right now, I select cell B1 and type the formula ". I
then manually copy and paste this formula to the remain cells in column
B to the point where the cells are populated in column A. I'd like to
be able to automate this process via a macro.

Thanks!

TJM

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


--

Dave Peterson


TJM[_3_]

How To: Macro Command To Reference Populated Cells Only
 
Thank you!

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



All times are GMT +1. The time now is 02:52 AM.

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