Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Calculations in VBA

I have a Named Range called "Data_Cells"
[='Sheet1'!$F$20:$L$31,'Sheet1'!$N$20:$O$31,'Sheet1 '!$O$42:$O$44)]

Now I wish to divide each cell in "Data_Cells" with the value in "P15"
using VBA like...

For Each cell in "Data_Cells"
Data_Cells.value/P15
Exit for

Please help






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default Calculations in VBA

see if this will work for you


Option Explicit
Dim r1 As Range
Dim r2 As Range
Dim cell As Range

Sub test2()
Set r1 = Range("data_cells")
Set r2 = Range("p15")
r1.Select
For Each cell In Range("data_cells")
cell.Value = cell.Value / r2
Next

End Sub

--


Gary


"Murtaza" <NoEmail@NoEmail wrote in message
...
I have a Named Range called "Data_Cells"
[='Sheet1'!$F$20:$L$31,'Sheet1'!$N$20:$O$31,'Sheet1 '!$O$42:$O$44)]

Now I wish to divide each cell in "Data_Cells" with the value in "P15"
using VBA like...

For Each cell in "Data_Cells"
Data_Cells.value/P15
Exit for

Please help








  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default Calculations in VBA

Sub test()
Dim cel As Range
Dim P As Double
P = Sheets(1).Range("P15").Value
If P = 0 Then Exit Sub
For Each cel In Range("Data_cells")
cel.Value = cel.Value / P
Next
End Sub

HTH. Best wishes Harald

"Murtaza" <NoEmail@NoEmail skrev i melding
...
I have a Named Range called "Data_Cells"
[='Sheet1'!$F$20:$L$31,'Sheet1'!$N$20:$O$31,'Sheet1 '!$O$42:$O$44)]

Now I wish to divide each cell in "Data_Cells" with the value in "P15"
using VBA like...

For Each cell in "Data_Cells"
Data_Cells.value/P15
Exit for

Please help








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MPG Calculations Terry Bennett Excel Worksheet Functions 8 June 10th 08 10:17 PM
Calculations Rich D Excel Discussion (Misc queries) 2 October 2nd 07 06:09 PM
Calculations J. McGonigal Excel Worksheet Functions 4 April 25th 06 07:53 AM
Need help on some calculations.. KristopherJensen New Users to Excel 6 January 2nd 06 02:28 PM
Between calculations Dan Wilson Excel Worksheet Functions 10 March 15th 05 05:06 PM


All times are GMT +1. The time now is 08:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"