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

i am having a problem rewriting the formula in my macro, i'm trying to
multiple the value of a cell that is to rows over to the right, however it
doesn't work as planned. any insight?

Private Sub cmdAdd_Click()
Dim Order As String
Dim Index As Variant
Dim nextrow As Long
Order = txtOrder.Value


With Range("K:K")
Set c = .Find(Order, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Cells(c.Row, 2).Value = Cells(c.Row, 2).Value + ((Me.txtShip.Value /
Me.txtPart.Value) * the value of a cell that is 2 rows to the right)

Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

End Sub
--
--Chip Smith--

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default formual in macro

Cells(c.Row, 2).Value = Cells(c.Row, 2).Value + ((Me.txtShip.Value / _
Me.txtPart.Value) * Me.txtPart.Offset(0, 2).Value)

"Chip Smith" wrote in message
...
i am having a problem rewriting the formula in my macro, i'm trying to
multiple the value of a cell that is to rows over to the right, however it
doesn't work as planned. any insight?

Private Sub cmdAdd_Click()
Dim Order As String
Dim Index As Variant
Dim nextrow As Long
Order = txtOrder.Value


With Range("K:K")
Set c = .Find(Order, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Cells(c.Row, 2).Value = Cells(c.Row, 2).Value + ((Me.txtShip.Value /
Me.txtPart.Value) * the value of a cell that is 2 rows to the right)

Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

End Sub
--
--Chip Smith--



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default formual in macro

saying two rows to the right is a big ambiguous. To the right of what. Rows
go up and down, not right and left. Some possible interpretations:

two rows down from c.row
Cells(c.Row, 2).Value = Cells(c.Row, 2).Value + ((Me.txtShip.Value /
Me.txtPart.Value) * cells(c.row + 2, 2))

two columns to the right of c.column (column M)

Cells(c.Row, 2).Value = Cells(c.Row, 2).Value + ((Me.txtShip.Value /
Me.txtPart.Value) * cells(cell.row,cell.column + 2))

Column D (two columns to the right of column 2)

Cells(c.Row, 2).Value = Cells(c.Row, 2).Value + ((Me.txtShip.Value /
Me.txtPart.Value) * cells(c.row,4))

--
Regards,
Tom Ogilvy



"Chip Smith" wrote:

i am having a problem rewriting the formula in my macro, i'm trying to
multiple the value of a cell that is to rows over to the right, however it
doesn't work as planned. any insight?

Private Sub cmdAdd_Click()
Dim Order As String
Dim Index As Variant
Dim nextrow As Long
Order = txtOrder.Value


With Range("K:K")
Set c = .Find(Order, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Cells(c.Row, 2).Value = Cells(c.Row, 2).Value + ((Me.txtShip.Value /
Me.txtPart.Value) * the value of a cell that is 2 rows to the right)

Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

End Sub
--
--Chip Smith--

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default formual in macro

i do apologize i meant to say columns, not rows. my mistake
--
--Chip Smith--



"PCLIVE" wrote:

Cells(c.Row, 2).Value = Cells(c.Row, 2).Value + ((Me.txtShip.Value / _
Me.txtPart.Value) * Me.txtPart.Offset(0, 2).Value)

"Chip Smith" wrote in message
...
i am having a problem rewriting the formula in my macro, i'm trying to
multiple the value of a cell that is to rows over to the right, however it
doesn't work as planned. any insight?

Private Sub cmdAdd_Click()
Dim Order As String
Dim Index As Variant
Dim nextrow As Long
Order = txtOrder.Value


With Range("K:K")
Set c = .Find(Order, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Cells(c.Row, 2).Value = Cells(c.Row, 2).Value + ((Me.txtShip.Value /
Me.txtPart.Value) * the value of a cell that is 2 rows to the right)

Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

End Sub
--
--Chip Smith--




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default formual in macro

Just a heads up to PCLive, but I don't think a textbox has an offset
property. Maybe you meant something else.

--
regards,
Tom Ogilvy


"PCLIVE" wrote:

Cells(c.Row, 2).Value = Cells(c.Row, 2).Value + ((Me.txtShip.Value / _
Me.txtPart.Value) * Me.txtPart.Offset(0, 2).Value)

"Chip Smith" wrote in message
...
i am having a problem rewriting the formula in my macro, i'm trying to
multiple the value of a cell that is to rows over to the right, however it
doesn't work as planned. any insight?

Private Sub cmdAdd_Click()
Dim Order As String
Dim Index As Variant
Dim nextrow As Long
Order = txtOrder.Value


With Range("K:K")
Set c = .Find(Order, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Cells(c.Row, 2).Value = Cells(c.Row, 2).Value + ((Me.txtShip.Value /
Me.txtPart.Value) * the value of a cell that is 2 rows to the right)

Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

End Sub
--
--Chip Smith--






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default formual in macro

Thanks Tom. I overlooked the period thinking it was a variable. Sorry for
the confusion.

"Tom Ogilvy" wrote in message
...
Just a heads up to PCLive, but I don't think a textbox has an offset
property. Maybe you meant something else.

--
regards,
Tom Ogilvy


"PCLIVE" wrote:

Cells(c.Row, 2).Value = Cells(c.Row, 2).Value + ((Me.txtShip.Value / _
Me.txtPart.Value) * Me.txtPart.Offset(0, 2).Value)

"Chip Smith" wrote in message
...
i am having a problem rewriting the formula in my macro, i'm trying to
multiple the value of a cell that is to rows over to the right, however
it
doesn't work as planned. any insight?

Private Sub cmdAdd_Click()
Dim Order As String
Dim Index As Variant
Dim nextrow As Long
Order = txtOrder.Value


With Range("K:K")
Set c = .Find(Order, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Cells(c.Row, 2).Value = Cells(c.Row, 2).Value + ((Me.txtShip.Value /
Me.txtPart.Value) * the value of a cell that is 2 rows to the right)

Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

End Sub
--
--Chip Smith--






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
Formual not working when 2003 WKB saved as 2007 Macro Enabled WKB Corey .... Excel Worksheet Functions 3 March 26th 09 05:44 AM
some help with an IF formual or something like it Lost Will Excel Worksheet Functions 4 November 19th 08 12:00 PM
WHAT DOES FORMUAL =C8+ 15 DO Tara Excel Discussion (Misc queries) 1 January 4th 07 03:38 PM
Set Formual Winnie Excel Discussion (Misc queries) 2 November 13th 06 09:47 AM
what is mean by ^ in formual khan Excel Programming 2 October 13th 05 12:16 PM


All times are GMT +1. The time now is 10:51 PM.

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"