ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code: Assign Function(s) to all cells in a column (https://www.excelbanter.com/excel-programming/349266-code-assign-function-s-all-cells-column.html)

cbrd[_4_]

Code: Assign Function(s) to all cells in a column
 

Posted: Sun Jan 01, 2006 3:07 pm Post subject: Assign Function t
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 thes
columns is from other worksheets.
Starting with row 2, every time info is put into this worksheet I wis
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 functio
everytime info is put in column A. I need this info on the same ro
where A was entered, but starting on Row 2 (Row 1 has all colum
headings):

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

Any ideas

--
cbr
-----------------------------------------------------------------------
cbrd's Profile: http://www.excelforum.com/member.php...fo&userid=3000
View this thread: http://www.excelforum.com/showthread.php?threadid=49724


Tom Ogilvy

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




cbrd[_5_]

Code: Assign Function(s) to all cells in a column
 

Thankyou for the help...much appreciated!


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



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

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