ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Put the result of the calculation between 2 columns in a new works (https://www.excelbanter.com/excel-discussion-misc-queries/2927-put-result-calculation-between-2-columns-new-works.html)

Metin

Put the result of the calculation between 2 columns in a new works
 
Hi all,

I have a worksheet with 18 columns. Each column has a lot of data, and each
time I have various number of data. The number of data can be between 200 and
5000 in one column. The number of data in each column is always equal.The
data starts at row 2, because row 1 is always the title.
I want to subtract the data from column J with data from column F, and the
results I want to put in a new sheet, called "calculate data" in Column F.
Could somebody tell me how to do this with VB.

Thanx,
-Metin-


Frank Kabel

Hi
why do you want to use VBA and not a simple formula?

--
Regards
Frank Kabel
Frankfurt, Germany
"Metin" schrieb im Newsbeitrag
...
Hi all,

I have a worksheet with 18 columns. Each column has a lot of data, and
each
time I have various number of data. The number of data can be between 200
and
5000 in one column. The number of data in each column is always equal.The
data starts at row 2, because row 1 is always the title.
I want to subtract the data from column J with data from column F, and the
results I want to put in a new sheet, called "calculate data" in Column F.
Could somebody tell me how to do this with VB.

Thanx,
-Metin-




Metin

I have it already in simple formula. I need it for further calculations and
when I have new data I don't want to use the template of a previous file.
Very often the users forgot to delete the remaining data of the previous file.
In VBA I have already did the insert of new sheet and the insert of the
titles.

If you know how to do it in VBA, pls tell me.

"Frank Kabel" wrote:

Hi
why do you want to use VBA and not a simple formula?

--
Regards
Frank Kabel
Frankfurt, Germany
"Metin" schrieb im Newsbeitrag
...
Hi all,

I have a worksheet with 18 columns. Each column has a lot of data, and
each
time I have various number of data. The number of data can be between 200
and
5000 in one column. The number of data in each column is always equal.The
data starts at row 2, because row 1 is always the title.
I want to subtract the data from column J with data from column F, and the
results I want to put in a new sheet, called "calculate data" in Column F.
Could somebody tell me how to do this with VB.

Thanx,
-Metin-





Bob Phillips

Here is a VBA solution

Sub test()
Dim i As Long
Dim cLastRow As Long
Dim oWS As Worksheet

With Worksheets("Sheet1")
cLastRow = .Cells(.Rows.Count, "J").End(xlUp).Row
Set oWS = Worksheets.Add
oWS.Name = "calculate data"
oWS.Cells(1, "J").Value = .Cells(1, "J").Value
For i = 2 To cLastRow
oWS.Cells(i, "J").Value = .Cells(i, "J").Value - _
.Cells(i, "F").Value
Next i
End With

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Metin" wrote in message
...
I have it already in simple formula. I need it for further calculations

and
when I have new data I don't want to use the template of a previous file.
Very often the users forgot to delete the remaining data of the previous

file.
In VBA I have already did the insert of new sheet and the insert of the
titles.

If you know how to do it in VBA, pls tell me.

"Frank Kabel" wrote:

Hi
why do you want to use VBA and not a simple formula?

--
Regards
Frank Kabel
Frankfurt, Germany
"Metin" schrieb im Newsbeitrag
...
Hi all,

I have a worksheet with 18 columns. Each column has a lot of data, and
each
time I have various number of data. The number of data can be between

200
and
5000 in one column. The number of data in each column is always

equal.The
data starts at row 2, because row 1 is always the title.
I want to subtract the data from column J with data from column F, and

the
results I want to put in a new sheet, called "calculate data" in

Column F.
Could somebody tell me how to do this with VB.

Thanx,
-Metin-








All times are GMT +1. The time now is 07:24 PM.

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