View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default 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