View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Assign Function(s) to all cells in a column

Right click on the sheet tab and select view code. At the top of the module,
In the left dropdown select worksheet and in the right dropdown select
Change.

Then put your code in that sub

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If target.count 1 then exit sub
if isempty(target) then exit sub
if Target.column = 15 then exit sub ' column O
cells(target.row,"O").Formula = "=I" & target.row & _
"-(L" & target.row & "*30)-M" & target.row
if Target.column = 1 then
application.EnableEvents = False
' adjust "F" to reflect the column where you want the formula
cells(Target.row,"F").Formula = "=LOOKUP(A" & _
Target.row & ",Customers!A:A,Customers!C:C)"
application.enableEvents = True
End if
End Sub

--
regards,
Tom Ogilvy

"cbrd" wrote in message
...

Posted: Sun Jan 01, 2006 3:07 pm Post subject: Assign Function to
every cell in column

--------------------------------------------------------------------------

------

I have a worksheet with columns A thru O.
Row 1 has all my column headings.
The rest of the page is blank. All the info that is put in these
columns is from other worksheets.
Starting with row 2, every time info is put into this worksheet I wish
for it to perform a funtion like this in column O for every new row:

=I2-(L2*30)-M2

------------------------------------------------------------------------


Another question, similar to above. I want to assign this function
everytime info is put in column A. I need this info on the same row
where A was entered, but starting on Row 2 (Row 1 has all column
headings):

=LOOKUP(A2,Customers!A:A,Customers!C:C)

Any ideas?


--
cbrd
------------------------------------------------------------------------
cbrd's Profile:

http://www.excelforum.com/member.php...o&userid=30009
View this thread: http://www.excelforum.com/showthread...hreadid=497244