Macro - Copy Multiple Sheets To Master
Have 52 weekly spreadsheets in a workbook and would like to create a macro to copy them into a master spreadsheeet in the same workbook plus, would like the master to be continually updated with any changes that are made to the individual spreadsheets.
View Complete Thread with Replies
Related Forum Messages:
Copy And Pasting From Multiple Sheets To A Master
There is a file that contains multiple worksheets. Each worksheet contains a template.
I'm trying to create a macro that will go to each worksheet and gather the information on one line in a master sheet. Then go to the next work sheet and do the same but return the data for that on the next row. And continue to do so until all the worksheets have returned data.
So far I have recorded the macro for the first sheet. How do I get it to now go to the next sheet, do the same thing, but return the data on the next line so it doesn't over write the data from the first sheet?
Copy Data From Multiple Sheets To One Master Sheet
I have been trying to make a code that copies all the data in A2:K50 in all the sheets (about 32 of them right now) and paste that information in 1 sheet (Master List). The code does work but for some sheets it only copies the first 2 or 3 records. Also, this code puts the name of the sheet the data came from but for the first 2 records in puts in the Master List its pasting the wrong Sheet name.
Dim ws As Worksheet
Dim lastRng As Range
Application.ScreenUpdating = False
Copy Same Range From Multiple Sheets To Master Sheet
I have multiple sheets (lets say for example a 100 of them) where I need to copy a Value from a fixed location (Col#,Row#) from each of the 100 sheets and store it in a column in a Master sheet.. in the end the Master sheet has only two columns.. first column A contains file name (of the sheet where I copied).. then adjacent column B has the copied value.. in other words the Master sheet will have 100 rows and two columns..for this example..
Combining Sheets From Multiple Workbooks Into Master
I have several workbooks that supervisors in a call center use to grade calls for quality.
Each supervisor has a seperate workbook, and after scoring the call, the supervisor runs a vb script that copies all of the data from the worksheet "observation" onto "sheet1" for storing the data.
So now I want to use another workbook to:
1. Copy each sheet1 from all of the supervisor workbooks onto a sheet named "cumulative" in a different workbook.
In a perfect world it would also:
2. Keep a count of how many observations were done by each supervisor each day
3. Keep a count of how many have been done week to date
4. Keep a count how many have been done total since January 1, 2009
Each workbook is kept on a network drive at s:supervisorsqadata and named - for example QAformMelissa.xls
I'm okay with keeping the master sheet in the same directory if that makes it easier to accomplish this.
Copying Files With Multiple Sheets Into One Master File
How do I write a vb macro that copies everything from multiple files, including sheets within files, and puts them into one master file. Here's what I have so far. I used a script from gnaga that worked great but it didn't copy seperate sheets. If you can help me out, I would greatly appreciate it.
Dim SrcBook As Workbook
Dim fso As Object, f As Object, ff As Object, f1 As Object
Application.ScreenUpdating = False
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.Getfolder("C:Temp")
Set ff = f.Files
For Each f1 In ff..........
Copy Multiple Values From Multiple Workbooks To Master Workbook
I want create a macro which will extract 6 values (see below) from a workbook tab called summary to an master workbook for reporting purposes. Each workbook has a unique file name e,g ACI1150.
Values on sheet SUMMARY:
I tried to adapt the below to get one item copied/extracted. However it would no work.
I am new to using macros
Dim MyDir As String, FN As String, SN As String, NR As Long
Application.ScreenUpdating = False
Data Extraction Multiple Workbooks And Sheets To Master Spreadsheet
I have directory with multiple workbooks. Each workbook contains multiple sheets (sheet 1, sheet 2, etc). On each sheet of the workbook, there are various data. The data I am looking to extract from these sheets are in the same cell of each sheet. (See data sheet –datasheet.xls). If I can extract these data without opening the file, it would be preferred. Otherwise, opening the workbook, extract the data, and then close the workbook is acceptable.
I would like the assistance to create a macro that will extract data from each sheet of the workbook in the directory at a time until all the workbooks and sheets within the directory are read. The macro shall extract data from cell B5, B6, B10:B20, and sheet name from each sheet of the workbook and copy these data to an active sheet called “US” on workbook, DesireResult.xls. The DesireResult.xls shows how the data should be copied over. Before copying the data to the DesireResult.xls workbook, the macro will prompt the user to enter a cell on the “US” sheet as the starting point to paste the information to. Prompting the user to enter the beginning cell shall happen only once and not for each workbook or sheet being read. The reason for this is because the “US” sheet will already have other data in it. After reading each sheet, the macro shall leave a blank row at the end. The data from the next sheet shall be pasted below the blank row. Note: all the workbooks contain macro and link to other file. When opening each workbook, the macro should automatically choose not to update the links.
Macro - Copy Value Only From Multiple Sheets Into One Sheet
This Macro works fine to copy data from multiple sheets into one master sheet, but it is also copying the formula. How can I change this Macro so that it is copying and pasting VALUE only?
Dim J As Integer
On Error Resume Next
' work through sheets
For J = 4 To Sheets.Count ' from sheet 3 to last sheet
Sheets(J).Activate ' make the sheet active
Selection.CurrentRegion.Select ' select all cells in this sheets
' select all lines except title
Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
' copy cells selected in the new sheet on last line
Copy Specific Worksheet From Multiple Workbooks Into Master
Objective: use VB to copy the first sheet (tab) from every Excel file in a specific folder to a new sheet/tab (for each) in a master spreadsheet. I will then aggregate this data into a summary table.
Following the advice of an old thread (Access: VBA combining multiple excel files to 1 new sheet), one time for each file in the folder. So with three excel files in the folder, I get 3 new tabs in my master spreadsheet but all are copies of the first tab in the master spreadsheet.
I'm wondering if maybe the code, which was in a post from 5 years ago, needs to be "modernized" for Excel 2007. Thanks for any help.
This is the code I'm using:
Fpath = "C: emp2" ' change to suit your directory
Fname = Dir(FilePth & "*.xls")
Do While Fname <> ""
Workbooks.Open Fpath & Fname
Fname = Dir
Conditionally Copy Data: Master Worksheet To Multiple Worksheets
I am searching for a formula or simple macro to select text data from column named "SM NAME" to corresponding worksheet. I need this to populate as many worksheets as there are SM Names. ( there are usually 10 SMs)
For Example in the Master Data there are Several SM names listed. I need to extract the "ID" and "Agent" columns in the Master and populate into the workshhet with the Approriate name tab. The Master list changes regularly.
Use Macro To Copy Rows From Several WB's To A Master WB
I am responsible for compiling a compilation of my company’s data from each source to a Master workbook, I need a macro that can be run from each divisions workbook (all are identical apart from the name and date) that will copy entire rows from 3 tabs into the same tabs on my master workbook.
The following is the criteria.
Master workbook name
"All ships compilation"
Tabs are identically named on both reports
Cruise Report YTD
Tables & Slots YTD
Cruise Report YTD, I need to copy rows 7 to 371 and paste them into the same tab “Cruise Report YTD” on the master report “All ships Compilation”, starting at the first blank row available.
Tables & Slots YTD I need to copy rows 8 to 372 and paste them into the same tab “Tables & Slots YTD” on the master report “All ships Compilation”, starting at the first blank row available
Staff Hours, I need to copy rows 2 to 100 and paste them into the same tab “Staff Hours” on the master report “All ships Compilation”, starting at the first blank row available
Macro: Copy Cells From All Worksheets Into Master Worksheet
I have been at this for days and i can't quite get it right.
I have multiple worksheets of clients all formatted the same.
I need a Macro/VBA that will take from Each sheet onto a master sheet the Name of the Client(Cell I1 from the sheet)
Under the name I need the text Authorization #: then the data(C3)
Under that I need the text Dates of Service Expiration: then the data (D5)
Then the text 90801 Balance: then the data from (C30)
Then the text 90806 Balance: then the data from (F30)
Then the text 90847 Balance: then the data from (I30)
Then the text 90853 Balance: then the data from (L30)
Then a couple Spaces then the same exact data from the next sheet...till all the work sheets are done.....is it possible?
Dave responded by suggesting the following:
Dim wSheet As Worksheet
Dim wsMaster As Worksheet
Set wsMaster = Worksheets("Master")
For Each wSheet In Worksheets
If UCase(wSheet.Name) <> "MASTER" Then
Destination:=wsMaster.Cells(Rows.Count, "A").End(xlUp)(2, 1)
'More Copy Method code here
Copy From Multiple Sheets Into One
i have a one file with differant sheet like Sheet name are as below:
There are a same title & Column in all sale sheet data like: Date,Name,add1,add2,DOB,city,state,username,Comments and Status.
In Total sales sheet: There is a one "All Data Get" button. when user click on button then All sales sheet data come in total sales sheet.
Copy Data From Multiple Sheets
I am using the following code to copy data from multiple tabs to a summary tab - it is only supposed to copy the data in the rows if the cells in Column A have data in them, its working, but for some reason it is copying the data in columns Y and Z for four extra rows even though there is no data in column A for those rows.
Create Multiple Sheets And Copy Data To Them
I have a worksheet with a list of project managers and a bounc of data on them.
How can i make a new file with sheets for every project manager in the list and copy the data for each one into his own sheet ?
Every project manager has many lines (there are about 200 managers and 30 000 lines and 30 columns )
I have managed to create a sheets for project managers from a list of unique entries but that's all.
Copy Tables From Multiple Sheets To One Worksheet
I need, I do not know Visual Basic, so I need something in simple Excel format that I can use before I am able to take the training (upon reading more threads, looks like VBA is just the editor used to create a macro where I can copy and paste in code text from your suggestions? I think I can handle that).
I need to condense multiple tables into one master table, and then perform calculations on those entries. Each table contains three columns, but after being manually pasted -- as I am doing currently -- into the condensed worksheet, there'll be two or three additional columns based on calculations from the entries. The Workbook does currently contain 2 worksheets that do not contain data in this format, so please share code that could exclude those? I am fine with every so often manually applying a formula on the last worksheet that says something like,
look in SH1 A2:C300. If entire row is not blank copy over contents, if blank move on to SH2, etc etc. Since I'm a newbie I imagine there are much more efficient ways to do this. I may be a little shaky on the VBA but surely I can copy and paste.
Copy Data To Multiple Sheets (Specific Requirements)
I am trying to create a macro that will copy data from one sheet to four other sheets depending on some requirments in the data. I have a main worksheet that will store the data, the name on this sheet will change daily, so you cannot use a "named" sheet in your macro. The other three names of the sheets are "Esky", "Indy", "Gfld", and "Other". When copying the data, I need to copy the entire row of data to the required sheet. The data comes in such as:
MZ03948 134 126.23
PZ34533 128 12.28
IM04985 630 198.50
Z109384 40 35.65
2130494 76 12.28
2236326 12 45.63
5123132 12 12.23
Based on the FIRST TWO characters in the first column, I need to copy the data to the specific sheet. I would assume a simple LEFT() function would work for this. Here are the requirments for each sheet:
Esky - "MZ" or "51"
Indy - "IZ" or "Z" or "21"
Gfld - "PZ" or "22"
Other - Anything else
Copy Data From Multiple Sheets To Single Sheet
trying to copy data from multiple sheets to one single sheet. I am pretty sure this is possible. The problem I am running into is that the number of sheets at any given time is dynamic. The numbering of the sheets is from 000 to 999 (they must be a three-digit code). The other issue I am having is I only want to copy the rows in each sheet that have an "x" in column "A". Also, the row in which the first "x" occurs can differ from sheet to sheet. I have attached a copy of the spreadsheet that indicates how the spreadsheet is layed out.
Copy Rows From One Book To Multiple Books And Sheets
I'm trying to copy rows from one workbook that is exported from access to multiple worksheets in multiple workbooks. I used a macro I found here from JBeaucaire that will copy the data for me but it over writes the information I have in rows 1-3 and also the rows below, 28-35.
Is there a way to copy the data without loosing the information in the first three rows and the rows below where the data goes?
Copy Data From Single Sheet To Multiple Sheets
I recieve a daily spreadsheet with ~25,000 rows of data and is 4 columns wide. Each day I need to break the data equally up into 19 or 20 different sheets within the same workbook. This is very time consuming as I need to copy the first ~1,000 rows and paste it into the first sheet, then I need to take the next ~1,000 rows and paste it into the second sheet, and so on.
I have attached a small example with desired output. In my example, the raw data file contains 19 records. For these 19 records, I need to distribute the records evenly between 5 individual sheets. In this case, each sheet will contain 4 records or less.
Open Multiple Workbooks & Copy Sheets
I have a created a main workbook with a macro that opens workbooks on a particular sheet from a list of workbook paths and filenames in the main workbook. The macro are suppose to copy the sheet and paste it into a sheet with a new name that I have defined from the list in the main workbook. I can get the macro to open the workbooks and close them. But I can't get the macro to copy the sheet into the main workbook.
I have attached the code and the workbook. I used slet_ark to delete previous sheet and hentark and henttekstfil to open the different workbooks.
The code I use are:
Public Sub Slet_ark()
Dim ark() As Variant
Dim Counter As Long
Dim FirstSheet As Long
Dim LastSheet As Long
Add Subtotal To Multiple Sheets & Copy
i am trying to do the following- can some one pleeeeeeease help me
Each tab has columns up to M.
1. Sum Column E for each tab(note column will varie in size)
2. Then copy Column C and Column E to one tab (called " upload)
there will be 60 tabs - so am tying to loop through and peform a subtotal for column E then copy "C" and "E" to another tab called "upload" note - all tabs will be copies to the one tab called "uplod once subtotal is performed.
Copy Data From Multiple Sheets (different Columns) Into A Main Sheet
I have multiple sheets Names(Sheet1-Sheet5).
Im trying to compile them all on the same sheet (Main Sheet). But each sheet is NOT the same. I need to choose what Columns needs to be copied (I can use one macro for each tab if needed)
For example I need Sheet1, Columns (A,C,E,G,S) copy that and then go to (Main Sheet) and paste in the next blank line (column A)
Seems like it does not know where to paste.
Here is one I have tried ....
Copy, Transpose & Consolidate Data From Multiple Sheets
writing a macro that could save me loads of time. In the attached file there are 2 separate sheets of data ( named "Elements Innovation" and "Dinttap") that I need copied, pasted, transposed and consolidated into one master sheet (named "Desired result"). Note that the fields that relevant cells are highlighted in yellow. In reality I'll have many (~100) of these sheets that I need the data extracted from, and the work looks like it can be automated using VBA to speed things up.
Copy Range From Multiple Sheets & Paste To Another Workbook
I am looking for either formula which will allow me to copy data from a workbook with multiple named sheets into a workbook with a single named sheet. For instance workbook 1 has sheets named bob, sue, and tom and there is a workbook 2 which only has sheet bob. I want to copy the range fo data from sheet bob in workbook1 to workbook 2 as long as workbook 2 has sheet bob.
Dynamically Altering Sheets From A Master Sheet
I have a workbook with four worksheets. Sheet1 is the master. On sheet one there is information in a 10x10 table. The first column of the table contains a status of "No, Maybe, Yes." A record will start with a status of No and move to Maybe and then yes. What I want to do is be able to dynamically fill sheet2-sheet4 with information from the master. If the status is "Yes" move that row to sheet2. If the status is "no" move that row to sheet 3. Etc. Further complication that is depending on status, I want specific columns from the master, not necessarily all of them.
Transpose Links From Individual Sheets To Master Sheet
I have multiple sheets on which users enter data in Cells B3 to B21 on each sheet.
I have a master sheet where the information entered on individual sheets is copied by links. On the master sheet the information is displayed in Rows. Thus data on Sheet1 B5:B25 is displayed in Row 6 cells H6:Z6 of Master Sheet, data on Sheet2 is displayed in Row 7 cells H7:Z7 etc. The formula in H6 of the Master Sheet is =Sheet1!B5, in H7 it is =Sheet2!B5 etc. It is of course not possible to use Autofill to copy formulas across on the Master sheet. It can be done manually but there are hundreds of cells to fill.
Is there an elegant way to copy the formulae on individual sheets onto the Master Sheet.
I want to be able to repeat the procedure later if additional sheets need to be added.
Combine All The Records In The The Mentioned Sheets To The Master Sheet
For Each Ws In Sheets(Array("SHEET101", "SHEET102", "SHEET103", "SHEET104", "SHEET105", "SHEET106", "SHEET107", "SHEET108"))
Finalrow = .Range("A65536").End(xlUp).Row
Set CpyRng = .Range("A2", .Cells(Finalrow, "AR"))
If Finalrow > 1 Then
CpyRng.Copy Sheets("Master").Cells(Rows.Count, "A").End(xlUp)(2)
Basically what it does is simply combine all the records in the the mentioned sheets to the master sheet.
There is a little problem. When one of the sheets are on a filtered mode, the data copied in the "Master" sheet are only visible cells.
Un-filtering before copying is an option (i.e. putting the code ".ShowAllData") IF I can put the exact filtering back after copying. Reason being that the sheets are owned by other parties and they do not want their own filtering be removed.
Macro To Copy Between Sheets
I have been using a macro for the last while and it has done the job untill recently. It is too slow and I need to speed it up. What is does is looks for a product code in column 3 of the "shelf" sheet and then goes to the "sheet 1" and if it finds it copys accross the information in each cell choosen. There are about 4000 products but the most a particular product will appear is twice. Also the information in columns "e - j" gets copied everytime to "sheet 1" the code is below and i have included an excel file.
'this section does the actual updating of the PLOF/SLOF for 1 prices
Dim cf As Range, s1 As Worksheet, s2 As Worksheet, p As Long
Dim firstfound As String
Set s1 = Worksheets("Sheet1")
Set s2 = Worksheets("Shelf_stock_Labels")
'Application. ScreenUpdating = False
p = 2
q = 1
Do While Not IsEmpty(s2.Cells(p, 4))
Set cf = s1.Columns.Find(s2.Cells(p, 4), SearchOrder:=xlByRows)
If Not cf Is Nothing Then
firstfound = cf.Address
List All Sheets Names From Multiple Workbooks & Copy Transpose Certain Columns
this may or may not be easy for some of you but its driving me nuts. Here's what I need to do.
1.Create a new workbook
2.Cycle through multiple workbooks and all worksheets within each workbook (all in the same folder). All workbooks will have the same structure.
3.Take the worksheet names and put them in rows
4.Take the data from the first column (column A) from the first worksheet of the first workbook and put them across the top (i.e. transpose the data). The first column will be the same in all workbooks so it doesn't matter where I get it from.
5.Copy the data from column E from each worksheet and paste them in rows in the new workbook (again transpose) corresponding to each worksheet.
6. Perform simple mathematical calculations at the end of each row.
I expect to have approximately 26 workbooks with a total of 7000 worksheets. In the target workbook (i.e. the new one), I expect there to be 7000 rows (corresponding to the 7000 worksheets) and about 260 columns.
The only reason I need to transpose stuff is because Excel 2007 doesn't have 7000 columns.
Here's an example of what it would look like.
Example worksheet (Input)-
Col A Col E
Imagine another worksheet called LMN with the same ColA but different values in Col E.
ColA Columns B Column C Column D
Sheet 1/1/2004 1/8/ 2004 1/15/2004
ABC $25 $30 $15
LMN $xxx $yyy $zzz
Run VB Macro On Multiple Sheets
Hi i have this macro below which works perfectly to clear the contents of column A. I will have multiple worksheets all named from 1,2,3,4,5 upto 50.
What i would like to do is modify this script below so it will run on the worksheets labelled above.
Macro For Printing Multiple Sheets
Print sheet 1, 3 and 7. Always print sheet 1, however only print sheet 3 and 7 if there in these sheets are values in the cells from row 8 and below.
(If that is to complicated it would be ok if the condition for printing sheet 3 and 7 is that there's a value in e.g. cell A8.)
I managed to create this script that allows me to print sheets 1, 3 and 7, however I can't seem to find out where to put the if-statement (I suppose that's how you do it?). Here's the script i created so far:
Creating Multiple Sheets From A Macro
I am creating a vacation calendar for all of my associates. I have 763 employees so, i want to run a macro that will react a worksheet for each of them. I will have an employee list that will create the sheets and I will have a VLOOK Up to update and pull information when we have new hires come on board.
Running Macro On Multiple Sheets
I would like to run the code below on selected sheets in my workbook:
Range("B9:AW38, AZ9:BE38, b3").ClearContents
I tried using this but it doesn't work:
Sheets( Array("sheet A", "sheet B", "sheet C")).Select
Range("B9:AW38, AZ9:BE38, b3").ClearContents
Macro To Copy Hyperlinked Sheets
I have a table of many rows and columns of information, some of which is hyperlinked to seperate sheets in the same workbook, some are not hyperlinked at all. What I want to do is select a column and when a hyperlink is found going down the column, copy the sheet that it is linked to into a new book, then find the next hyperlink and copy that sheet into the same book as the first one. So if I have 25 hyperlinks in the column, I finish up with a new book containing 25 sheets in the order they were found. Hope someone can help me with this, it will save me hours of work.
Auto-populate Data To A Master Worksheet From Other Sheets In A Shared Workbook
I have never really used VBA and so am completely stuck at this problem. I need to create a macro which auto-populates a master worksheet from the individual user sheets in a shared workbook. Sheet 1 is the master sheet "Team Stats". There will be an undetermined number of individual worksheets to accomodate new staff. Each worksheet will be identical, using columns A-I with row 1 having the headings:
Date, Name, Reference, Value, Price, Age, Purchased?, Destination, Add. Products (the last 3 columns will have a drop-down list which will be used to enter data into the cell). There will be a varying number of rows in each of the individual sheets. If possible I would like the macro to run every time data is entered into one of the individual worksheets. If this is not then it would be fien to update every time the workbook is opened.
Run A Macro In Multiple Sheets At The Same Time
I have to run the macro in over 75 sheets every month and they are divided in few workbooks. The workbooks have 2 summary sheets and then the sheets I need to run the macro. Can you help me to run the macro in all of these workbooks running it just once?
' TelcoTicketsCleaning Macro
' Macro recorded 6/13/2007 by EQUANT
Dim lastrow As Long
lastrow = Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
For r = lastrow To 46 Step -1 'Remove rows with DSL, ISDN and PSTN services..................
Macro: Print Ranges From Multiple Sheets
I am trying to write what I thought would be a simple macro to print out specific areas of my worksheets. I have shown the code below; the line causing the problem I have highlighted in RED. I am getting the following error message: "Select method of range class failed".
Reading other posts here. I think this may have something to do with the macro being assigned to a command button in one worksheet (AY114) and I am trying to get the macro to run on both the worksheet that the command button is in (AY114) as well as another worksheet (AY062).
ActiveSheet.PageSetup.PrintArea = "$A$4:$J$53"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.PageSetup.PrintArea = "$A$56:$M$151"......................
Multiple Data Sheets In One Macro Model
I have: + three raw data sheets (needed as 3 lots of data with 25K records in each). + I also have a model that I want to take each record from each sheet, populates some cells in a seperate calculation sheet and then gets a result - which it adds to a total (array).Finally I have + a clever macro that shows me what % of the way through I am (i.e. displays the number of record processed out of the 75K (3*25K) total)
While I have got the model to work - there is some untidy code used where I start my clever % macro for x = 1 to 75K then repeat the same instructions for running the model for each section i.e. sheet 1 : 1 to 25000, then the same instructions for sheet 2, 1 to 25000 etc etc. and then end it I want to know if there is any clever coding that will let me go from one sheet to another when there is an empty cell struck on the active sheet?
Macro To Apply Subtotals To Multiple Sheets
I am trying to loop through all of my worksheets in my workbook to apply a subotal to each of the sheets. I can get it to work with applying to just one named sheet, but I cannot get the loop to work. The sheets named "data" and "PriceList" do not need the subtotal applied.
Below is the code I am using:
Dim LastRow As Long
Dim wsDst As Worksheet
Macro To Create Multiple Graphs From X Sheets
I am trying to use VB to create 50 charts each with 3 lines using data from 3 different excel spreadsheets in the same workbook. I am able to create one chart with 3 lines using data from the three spreadsheets, this is good. However I exprience problems when i try to insert a loop to create 50 charts that correspond the the rows in each spreadsheet. I am new to VB and am very inexperienced with VB. In each worksheet my data is arranged in rows. row 1 of each worksheet has the header information and rows 2 through row 50 have my corresponding data. for example A2 lists the name and F2 through T2 lists the data. I have tried a bunch of different things but nothing seems to alllow me to be able to create multiple charts which correspond to each row of data?
Dim arow As Integer
Dim acol As Integer
Dim StartPoint As Integer
Dim EndPoint As Integer
Dim rStartPoint As String
Dim rEndPoint As String
StartPoint = 2
EndPoint = 4
For arow = 2 To 5
rStartPoint = "f" & StartPoint
rEndPoint = "t" & EndPoint
ActiveChart.ChartType = xlLine 'Type of graph........................