help w easy VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I'm new to the VBA side of things. I want to select a range of cells and
for each cell in that selection, divide it by the value that is in row1 of
the same column, and return that value to the cell. (I'm converting a number
to a percent by dividing current number by total number, which is kept in row
1, same column.) I have some of the code, but don't know how to represent
the value of row 1, same column. Can someone please assist? thanks - Russ

Sub ConvertHoursToPercent()
Dim Cell As Range
For Each Cell In Selection
If IsNumeric(Cell.Value) Then Cell.Value =
Next Cell
End Sub
 
Sub ConvertHoursToPercent()
Dim Cell As Range
For Each Cell In Selection
If IsNumeric(Cell.Value) Then
Cell.Value = Cell.Value / Cells(Cell.Row,1).Value
End If
Next Cell
End Sub

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Thanks Bob. I still struggle with this stuff. I know what I want to do but
I can't figure out the whole object model relationship thing and browsing the
Object Model isn't helping me yet. I'm sure that just comes with time.

thx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top