create new sheets for every row of main sheet and output of new sheets shown in main sheet.

ganu learner

New Member
Joined
Dec 31, 2019
Messages
43
Office Version
  1. 2013
Platform
  1. 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







NiftyBank MW10.02.2020.xlsx
ABCDEFGHIJKLMNOPQRS
1Trading symbolLTPBid qtyBid rateAsk rateAsk qtyLTQOpenHighLowPrev closeVolume traded todayOpen interestATPTotal bid qtyTotal ask qtyExchangeLTTLUT
2AXISBANK-EQ740.75353740.55740.752061746.3746.8739.7748.1515098430742.43417675862702NSE10-Feb-20 10:53:23 AM10-Feb-20 10:53:23 AM
3BANKBARODA-EQ90.955090.990.951718220091.8592.390.692.054939463091.3915931822521485NSE10-Feb-20 10:53:20 AM10-Feb-20 10:53:23 AM
4CANBK-EQ187.9264187.9188101327189.95191.8187.1519028625960189.218739901115813NSE10-Feb-20 10:53:20 AM10-Feb-20 10:53:23 AM
5FEDERALBNK-EQ91.1431791.191.1549981291.5591.5590.591.251882974090.8813749441376122NSE10-Feb-20 10:53:21 AM10-Feb-20 10:53:22 AM
6HDFCBANK-EQ1233.14951233.11233.229551242.951242.951226.051242.2154062701232.03271890514393NSE10-Feb-20 10:53:22 AM10-Feb-20 10:53:22 AM
7ICICIBANK-EQ537.95730537.955385041538.65542.25535.35536.4542358730538.479846171633314NSE10-Feb-20 10:53:22 AM10-Feb-20 10:53:22 AM
8INDUSINDBK-EQ1277.5781277.11277.53506130413041275.61298.8107696301282.77232985446904NSE10-Feb-20 10:53:20 AM10-Feb-20 10:53:22 AM
9KOTAKBANK-EQ1650.7141650.551650.7234166016601645.71653.0533200001650.71164435236926NSE10-Feb-20 10:53:20 AM10-Feb-20 10:53:23 AM
10PNB-EQ57.834557.7557.8489511558.7558.957.658.84626394058.2325153923065665NSE10-Feb-20 10:53:21 AM10-Feb-20 10:53:23 AM
11SBIN-EQ318.351894318.3318.35936200319.8322.8316.9320.55108769770319.2617503083274209NSE10-Feb-20 10:53:22 AM10-Feb-20 10:53:22 AM
12YESBANK-EQ38.855086538.838.85126394104040.7538.238.769645679039.34527945812438221NSE10-Feb-20 10:53:22 AM10-Feb-20 10:53:22 AM
13
14
NiftyBank MW
Cell Formulas
RangeFormula
A2:S12A2=RTD("pi.rtdserver", ,"NSE_AXISBANK-EQ", "TradingSymbol")
 

Some videos you may like

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Watch MrExcel Video

Forum statistics

Threads
1,114,492
Messages
5,548,362
Members
410,828
Latest member
A9Bosv3
Top