PDA

View Full Version : Hi, All I Need Some Help Here PLZZZZZZZZZZ

MaxJan
11-27-2012, 12:34 PM
Hi, All:
Thanks for losting your time trying to help me.
I am new in Excel VBA and i have a problem.
I attached an excel workbook include 2 sheets.
Sheet1 has vba code (I founded by google after 2 days searching and studying loop functions) to do this loop function as :
C1=A1*B1
C2=A2*B2
C3=A3*B3
.
.
.
.
Do Loop Until result equal 0

My problem in sheet2
I want the same code in sheet1 but application on COLUMNS.
I want this code to do as following:
A3=A1*A2
B3=B1*B2
C3=C1*C2
.
.
.
.
after one another day trying all i can do the first 2 columns
can any one help me to make it for 1000 columns (REMARK: NOT UNTIL EQUAL TO ZERO AS PER SHEET1).
PLZZZZZZZZZZZZZZZZZ

patel
11-27-2012, 12:58 PM
for Sheet2
Sub TestLoop1()
Dim row As Integer
Lastcol = 6
Range("A3").Formula = "=A1*A2"
Range("A3").AutoFill Range(Cells(3, 1), Cells(3, Lastcol)), xlFillDefault
End Sub

MaxJan
11-27-2012, 01:17 PM
thaaaaaaanks alot really really thanks alot

MaxJan
11-27-2012, 01:25 PM
Mr. patel
Thanks A lot for your greate help
i need this code to repeat it self for (No. of Rows) to be as following:

A3=A1*A2
B3=B1*B2
C3=C1*C2
.
.
.
A6=A4*A5
B6=B4*B5
C6=C4*C5
.
.
.
A9=A7*A8
B9=B7*B8
C9=C7*C8
.
.
.
and so on....
Thanks Again

MaxJan
11-28-2012, 12:22 AM
Hi, guys:
Can't any body help me
plzzzzzzzz

patel
11-28-2012, 01:35 AM
you can use the above code changing values, but I think it's more rapid copy formulas manually

Bob Phillips
11-28-2012, 01:59 AM
Dim lastrow As Long
Dim lastcol As Long

With ActiveSheet

lastrow = .Cells(.Rows.Count, "A").End(xlUp).row
lastcol = .Cells(1, .Columns.Count).End(xlToLeft).Column
For i = 3 To lastrow + 1 Step 3

.Cells(i, "A").Resize(, lastcol).FormulaR1C1 = "=R[-2]C*R[-1]C"
Next i
End With
End Sub

MaxJan
11-28-2012, 09:29 AM
thanks, greate greate greate thanks for all of you brothers