ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro - how to make working for colums D:X (https://www.excelbanter.com/excel-programming/322620-macro-how-make-working-colums-d-x.html)

ZEB

macro - how to make working for colums D:X
 

Hi,

I make macro:

Sub macro1()
Range("D6").Select
ActiveCell.FormulaR1C1 = "0"
Range("D16").Select
ActiveCell.FormulaR1C1 = "0"
While Range("D23") < 0
Range("D23").GoalSeek Goal:=0, ChangingCell:=Range("D6")
Wend

While Range("D23") 0
Range("D23").GoalSeek Goal:=0, ChangingCell:=Range("D16")
Wend

End Sub

How to make it automaticly working for range of cells (D6:X6) ,
(D16:X16) and (D23:X23) ?

ZEB

Solution is macro - how to make working for colums D:X
 
ZEB wrote:


Hi,

I make macro:

Sub macro1()
Range("D6").Select
ActiveCell.FormulaR1C1 = "0"
Range("D16").Select
ActiveCell.FormulaR1C1 = "0"
While Range("D23") < 0
Range("D23").GoalSeek Goal:=0, ChangingCell:=Range("D6")
Wend

While Range("D23") 0
Range("D23").GoalSeek Goal:=0, ChangingCell:=Range("D16")
Wend

End Sub

How to make it automaticly working for range of cells (D6:X6) ,
(D16:X16) and (D23:X23) ?



Sub xx()

For a = 4 To 24

Range(Cells(6, a), Cells(6, a)).Select
ActiveCell.FormulaR1C1 = "0"

Range(Cells(16, a), Cells(16, a)).Select
ActiveCell.FormulaR1C1 = "0"


While Range(Cells(23, a), Cells(23, a)).Value < 0
Range(Cells(23, a), Cells(23, a)).GoalSeek Goal:=0,
ChangingCell:=Range(Cells(6, a), Cells(6, a))
Wend

While Range(Cells(23, a), Cells(23, a)).Value 0
Range(Cells(23, a), Cells(23, a)).GoalSeek Goal:=0,
ChangingCell:=Range(Cells(16, a), Cells(16, a))
Wend

Next a

End Sub


All times are GMT +1. The time now is 05:18 AM.

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