I'm pretty new to creating Macros in Excel and using VBA.
Let's say I have a model based on a drop-down list. Based on the item selected from that list, model analyses according data and creates results. My point is to have these results compared for all the components from the list, in another sheet. The problem is that list includes around 200 item numbers.
What I need my macro to do is:
Choose the item number from the drop-down list in cell A1 in the "Sheet1"
Copy the range A1:E2 in the "Sheet1"
Paste the results to the Range A1:E1 in "Sheet2"
Go back to "Sheet1" and choose next item from the list
Copy the same range
Paste it to "Sheet2" one row below the previous one (creating a list)
And repeat the action until the last item on the list is used.
Does anybody have any advises how to write this macro down?
The task is by far exceeding my current programming skills. I searched everywhere, but couldn't find anything what would guide me into solution.
I implemented what you want on an Excel workbook with two sheets. Download it here:
http://s000.tinyupload.com/?file_id=05985444391023940738
Try this. Does it do what you need?
Related
I have two different sheets in a workbook with data, all of this data is organized by Site ID's. What I want to do is use these site ID's to create a hyperlink in one of the data sheets that when clicked takes the user to the corresponding Site ID in the other sheet. The sheet name where I want to write the hyperlinks to is called "Report_Manual" and I want to write hyperlinks down every row down the first column. The sheet that I am hyperlinking to is called "Data". The premise Ids are located in column C for sheet "Report_Manual" and column K in sheet "Data". Below is an a ttempt of what I was trying to generate in excel for a single cell formula however the issue I ran into for this formula is that the Premise ID's in sheet "data" are variant data type while the Premise ID's in sheet "Report Manual" are integer data type. This makes even a simple formula like the one below not get any matches as the data types being matched aren't the same.
=HYPERLINK("#"&CELL("address",INDEX(Data!K3:K580001,MATCH(C3,Data!K3:K580001,0))),C3)
If anyone has any idea of a macro to solve this issue that would be extremely helpful.
If the IDs in "Data" are text, try changing your match lookup value to text:
=HYPERLINK("#"&CELL("address",INDEX(Data!K3:K580001,MATCH(TEXT(C3,0),Data!K3:K580001,0))),C3)
My problem is as follows, I have a workbook with (to begin with) 2 worksheets, the first (called WIP) acts as a form of data entry, each new occurrence of the BoM requires an insertion of 4 columns which happens to the left of the existing columns. At the same time a new worksheet is created based on a copy of the existing second worksheet (called FitOut) which pulls various bits of a data from the first worksheet based mainly upon the version of the BoM selected and the supplier referenced.
Of course adding new columns to the WIP sheet causes the functions, arrays and formulas in the sheets to automatically update, I had used a quick workaround by using some code to hold and then paste the new occurrences data into the worksheet which is created at the start of the macro, however the formulas have become slightly complex (due to the need to look for the previous 4 occurrences and return values based on specific cell locations) that the 256 character limit has been completely shot ( I think I'm over 800 on some bits).
I've very limited as to the layout of the WIP sheet, and the sheet needs to be fairly idiot proof (hence macros, buttons etc) but it needs to run well...
ANy and all suggestions/help would be much appreciated.
I have put an example of the formula I am trying to use, if it can be condensed further pleas let me know:
=IFERROR(IF($C$1='WIP'!$U$1,(INDEX('WIP'!$A$1:$X$2500,SMALL(IF('WIP'!$U$1:$U$2500=$A$1,ROW('WIP'!$U$1:$U$2500)),ROW(6:6)),COLUMN('WIP'!$C:$C))),(IF($C$1='WIP'!$X$1,(INDEX('WIP'!$A$1:$AA$2500,SMALL(IF('WIP'!$X$1:$X$2500=$A$1,ROW('WIP'!$X$1:$X$2500)),ROW(6:6)),COLUMN('WIP'!$C:$C))),(IF($C$1='WIP'!$AA$1,(INDEX('WIP'!$A$1:$AD$2500,SMALL(IF('WIP'!$AA$1:$AA$2500=$A$1,ROW('WIP'!$AA$1:$AA$2500)),ROW(6:6)),COLUMN('WIP'!$C:$C))),(INDEX('WIP'!$A$1:$AG$2500,SMALL(IF('WIP'!$AD$1:$AD$2500=$A$1,ROW('WIP'!$AD$1:$AD$2500)),ROW(7:7)),COLUMN('WIP'!$C:$C)))))))),"")
I am working in Excel 2013 and am having some trouble. I have researched online all day and can't seem to find anything that solves my problem.
I have an Excel document that consists of 6 sheets:
Format
Summary
1.1 Detail
1.2 Detail
1.3 Detail
1.4 Detail
The 'detail' sheets are formatted all the same. The 'Summary' sheet rolls up all the values from the 'details' sheets and has all kinds of charts and useful information in it. The 'format' sheet is what I created to try to make this document more dynamic and useful for all different kinds of projects. This document is being used for estimating projects, so different projects are going to have different amounts of 'details' sheets.
SO, my goal is to have a blank in the 'format' sheet that asks how many details are needed. When the user types in 5, the code will add a sheet named '1.5 Detail' to the end of the workbook and have it formatted the same as the other 'details' sheets. Is this possible using VBA? Also, is there a way to make the charts and formulas include the new tab when it is added without manually going and adding it to everything?
Thanks in advance!
Let's say you had three detail worksheets named: d_1, d_2, and d_3.
Each has an Excel Table named Labor with a column entitled "Cost". Each Labor table has a unique number of data rows.
On a summary sheet you could sum all of them like so:
=SUM(d_1:d_3!Labor[Cost])
The above will give you the labor cost grand total from all sheets. It is summing all of the rows from the tables and is not dependent on any summary information in the detail sheets.
So if you add a new detail sheet, d_4, then yes the example formula would need to be updated. HOWEVER, there is an old trick to get around this...
Create two additional sheets with the same tables, but with only one row of ZERO values in each table. Call the first one of these sheets "START". Call the second one of these sheets "END". Place START immediately before the first detail sheet, and place END immediately after the last detail sheet. NOW MAKE BOTH INVISIBLE.
Finally change the example formula to:
=SUM(START:END!Labor[Cost])
Now when new detail sheets are added, d_4, d_5, d_6, d_n, no change needs to happen to the formula on the summary sheet, yet all of the new data are included in the summary calculation.
Use ThisWorkbook.Worksheets.Count to count the number of sheets. Then if it is less, use Worksheets.Add and ActiveSheet.Move After:=Sheets(ActiveWorkbook.Sheets.Count) to add it on to the end.
I've seen many questions on this forum about linking Excel files based on cell values and INDIRECT always pops up as an answer, and it does do function and fill my sheet the way that I want, but I need to find a way to work with the source file being closed. My problem when it comes to linking, is that the file path to pull the data from will not be known until part of the file name is entered into a cell.
For example, in 'Print Summary' workbook, Sheet1 Cell A2 is where the file name is entered as a number 12345 (and gets auto-formatted to place 'WIP' in front) which represents WIP12345.xls. WIP12345.xls is a form that holds information that needs to populate certain columns across row 2. WIP12345.xls is an order form and completed days ahead. Once it has been approved, the summary workbook is updated with the WIP#.
I did CONCATENATE WIP12345 and .xls to create the file name WIP12345.xls on Sheet2, and I have a Macro that copies and pastes special as value to turn the result into text. But, I can't find a way to create a formula that will take this value and lookup the file to pull information from. I need to pull and fill information from different cells to 10 columns down 43 rows (each row representing a different WIP#####.xls file).
I'm guessing VBA is the only way to go, but I have no idea how to write it. Anyone have a direction they can point me in? I hope I'm coming across clearly.
The free add-in morefunc.xll contains a function called Indirect.Ext, which works with closed worbooks.
I have been looking for a solution to my problem for the past 48 hours and I couldn't find anything. Keep in mind I have very basic programming knowledge and I might have overlooked something to fit my needs without understanding the code behind it.
I have an excel workbook with a sheet containing all of the data.
It's a list of shipments going in and out of a port.
Now when something is loaded, a "Date Loaded" cell is populated with the date automatically.
What I need for every row that has a blank "Date Loaded" cell to be copied to a new workbook which will be named by the date it was generated (i.e.:031814-PM) depending on the time of the day, PM could be AM.
Now I might not need all the columns to be copied to the new workbook. I need a way to exclude those columns during the copying process.
I want the VBA script to be called with a button that will be at the top of the data worksheet so that when we click on it, the new workbook is generated.