ganu learner
New Member
- Joined
- Dec 31, 2019
- Messages
- 47
- Office Version
- 2013
- Platform
- Windows
Respected Excel Masters I cannot know about VBA programming so I post a task for all of my friends for which I am very thankful in advance. I want vba script for some condition below
My main sheets data received from RTD SERVER IN this sheet
1. Firstly 8 blank column add in my main sheet after B column.
2. now some column copy and paste in that blank column. Data of Column R,S,T,Y copy in column C,D,E.F accordingly
col R data copy in col F
col S data copy in col C
col T data copy in col E
col Y data copy in col D
3. now creat 11 new sheets In which row 1 is common for every new sheet.
Row 1 and Row 2 copy in new sheet 1.
again Row 1 and Row 3 copy in new sheet2. now all of 11 Row copy in new sheets with Row 1.
4. After create 11 new sheets I want some date for each new sheet. currently I use vba script for my main sheet for row 2 data save in same sheet.
but I want 11 new sheets for every Row with some condition change in that vba script. currently I am using below vba script for main sheet.
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 < 15 Then currow = 15
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)
Cells(currow + 1, 5) = Cells(capturerow, 5)
Cells(currow + 1, 6) = Cells(capturerow, 6)
If currow > 15 Then
If Cells(currow, "B") > Cells(currow + 1, "B") Then
col = "H"
ElseIf Cells(currow, "B") < Cells(currow + 1, "B") Then
col = "I"
Else
col = "J"
End If
Cells(currow, col) = Cells(currow + 1, "C") - Cells(currow, "C")
End If
Range("H4").Value = WorksheetFunction.Sum(Range("H5:H" & currow))
Range("I4").Value = WorksheetFunction.Sum(Range("I5:I" & currow))
Range("J4").Value = WorksheetFunction.Sum(Range("J5:J" & currow))
handerror:
Application.EnableEvents = True
End Sub
My main sheets data received from RTD SERVER IN this sheet
1. Firstly 8 blank column add in my main sheet after B column.
2. now some column copy and paste in that blank column. Data of Column R,S,T,Y copy in column C,D,E.F accordingly
col R data copy in col F
col S data copy in col C
col T data copy in col E
col Y data copy in col D
3. now creat 11 new sheets In which row 1 is common for every new sheet.
Row 1 and Row 2 copy in new sheet 1.
again Row 1 and Row 3 copy in new sheet2. now all of 11 Row copy in new sheets with Row 1.
4. After create 11 new sheets I want some date for each new sheet. currently I use vba script for my main sheet for row 2 data save in same sheet.
but I want 11 new sheets for every Row with some condition change in that vba script. currently I am using below vba script for main sheet.
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 < 15 Then currow = 15
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)
Cells(currow + 1, 5) = Cells(capturerow, 5)
Cells(currow + 1, 6) = Cells(capturerow, 6)
If currow > 15 Then
If Cells(currow, "B") > Cells(currow + 1, "B") Then
col = "H"
ElseIf Cells(currow, "B") < Cells(currow + 1, "B") Then
col = "I"
Else
col = "J"
End If
Cells(currow, col) = Cells(currow + 1, "C") - Cells(currow, "C")
End If
Range("H4").Value = WorksheetFunction.Sum(Range("H5:H" & currow))
Range("I4").Value = WorksheetFunction.Sum(Range("I5:I" & currow))
Range("J4").Value = WorksheetFunction.Sum(Range("J5:J" & currow))
handerror:
Application.EnableEvents = True
End Sub
Cell Formulas | ||
---|---|---|
Range | Formula | |
A2:S12 | A2 | =RTD("pi.rtdserver", ,"NSE_AXISBANK-EQ", "TradingSymbol") |