ganu learner
New Member
- Joined
- Dec 31, 2019
- Messages
- 47
- Office Version
- 2013
- Platform
- Windows
Res all Genius
Please do for me I am very thankful to you for make a dream script for me
At present I do my task again and again so that I waste too much time to do this
firstly I create new sheet from my master sheet according to row manually and rename my new sheet according to column A .
Than I paste my vba script for all my new sheets . In that process I waste my most of time .
So please make a new script for me and merge my currently running script with it
This is dynamically updated file so data of every row is updated by RTD SERVER.
In attached file I have total 9 rows ( my every new file with dynamic Row) . First row is header and from Row2 to Row 9 are my data row.
1.create new sheet for every Row ( from row2 to row 9) all my new sheets first row is common
example newsheet 1 = row 1 and row 2
new sheet 2 = row 1 and row 3...........................................................
new sheet 8 = row 1 and row 9
2. after create new sheets my main task is here. At present I paste my vba script to all new sheets manually.
currently I use below script for all of my new sheets.
Private Sub Worksheet_Calculate()
Dim capturerow As Long, currow As Long, col As String
On Error GoTo handerror
Application.EnableEvents = False
capturerow = 2
currow = Range("A65536").End(xlUp).Row
If currow < 5 Then currow = 5
Cells(currow + 1, 1) = Cells(capturerow, 1)
Cells(currow + 1, 2) = Cells(capturerow, 2)
Cells(currow + 1, 3) = Cells(capturerow, 3)
Cells(currow + 1, 4) = Cells(capturerow, 4)
If currow > 5 Then
If Cells(currow, "B") > Cells(currow + 1, "B") Then
col = "E"
ElseIf Cells(currow, "B") < Cells(currow + 1, "B") Then
col = "F"
Else
col = "G"
End If
Cells(currow, col) = Cells(currow + 1, "C") - Cells(currow, "C")
End If
Range("E4").Value = WorksheetFunction.Sum(Range("E5:E" & currow))
Range("F4").Value = WorksheetFunction.Sum(Range("F5:F" & currow))
Range("G4").Value = WorksheetFunction.Sum(Range("G5:G" & currow))
handerror:
Application.EnableEvents = True
End Sub
Please do for me I am very thankful to you for make a dream script for me
At present I do my task again and again so that I waste too much time to do this
firstly I create new sheet from my master sheet according to row manually and rename my new sheet according to column A .
Than I paste my vba script for all my new sheets . In that process I waste my most of time .
So please make a new script for me and merge my currently running script with it
This is dynamically updated file so data of every row is updated by RTD SERVER.
In attached file I have total 9 rows ( my every new file with dynamic Row) . First row is header and from Row2 to Row 9 are my data row.
1.create new sheet for every Row ( from row2 to row 9) all my new sheets first row is common
example newsheet 1 = row 1 and row 2
new sheet 2 = row 1 and row 3...........................................................
new sheet 8 = row 1 and row 9
2. after create new sheets my main task is here. At present I paste my vba script to all new sheets manually.
currently I use below script for all of my new sheets.
Private Sub Worksheet_Calculate()
Dim capturerow As Long, currow As Long, col As String
On Error GoTo handerror
Application.EnableEvents = False
capturerow = 2
currow = Range("A65536").End(xlUp).Row
If currow < 5 Then currow = 5
Cells(currow + 1, 1) = Cells(capturerow, 1)
Cells(currow + 1, 2) = Cells(capturerow, 2)
Cells(currow + 1, 3) = Cells(capturerow, 3)
Cells(currow + 1, 4) = Cells(capturerow, 4)
If currow > 5 Then
If Cells(currow, "B") > Cells(currow + 1, "B") Then
col = "E"
ElseIf Cells(currow, "B") < Cells(currow + 1, "B") Then
col = "F"
Else
col = "G"
End If
Cells(currow, col) = Cells(currow + 1, "C") - Cells(currow, "C")
End If
Range("E4").Value = WorksheetFunction.Sum(Range("E5:E" & currow))
Range("F4").Value = WorksheetFunction.Sum(Range("F5:F" & currow))
Range("G4").Value = WorksheetFunction.Sum(Range("G5:G" & currow))
handerror:
Application.EnableEvents = True
End Sub
Last edited: