I have an Excel workbook with various tabs on it.
In Sheet 1 (named: ‘Pricing Calculator’) you can input various data and it calculates a price.
Sheet 2 (named: ‘Final Copy’) is basically the same as Sheet 1, however it is not used for inputting data. So in this sheet cell A1=’Pricing Calculator’!A1 etc. for most of the sheet.
However, sometimes Sheet 1 (‘Pricing Calculator’) is copied and that and the copied sheets renamed to ‘Option 1’, ‘Option 2’, ‘Option 3’ etc. Sheet 2 (‘Final Copy’) only needs to use information out of one of these sheets, but which one will depend on which option is chosen.
I have tried adding a cell into Sheet 2 (say it was A30) where you can type in exactly the name of the sheet to get the data from, and changing the cells to =’A30’!A1 etc, but this doesn’t work because it is looking for a sheet called ‘A30’.
It works by clicking ‘replace’ and changing everything that says ‘Pricing Calculator’ to ‘Option 2’ or whatever. But I have got to password protect all of the sheets so that no one can change them, therefore I can’t use the replace method!
Does anyone have any ideas as to what I could do? I would prefer to avoid using macros or VBA if possible.
You could use INDIRECT() for this.
=INDIRECT("'" & A30 & "'!A1")
Related
I want to speed up my macro by using manual calculations until the end, but there's a part where I break links from another workbook. I tried to do this, but it just turned back empty cells instead. Am I not able to use manual calculations when breaking links? Sorry if this question was asked I was having difficulty finding something on it
If you broke a link to an external Excel, you can't retrieve the data anymore. It actualy deletes any formulas. For instance, if you have a 2 Workbooks (Book1 & Book2) with 10 in cell A1 of Book1 and =[Book1]Sheet1!$A$1 in cell A1 of Book2, if you go to Data > Edit Link > Break Link the warning message is quite clear
Breaking links permanently converts formulas and external references to their existing values. Because this cannot be undone, you may want to save a version of this file with a new name.
And then the value in cell A1 of Book2 got converted to 10. Changes in Book1 will not appear in Book2 anymore
I am new to Excel macros but have recently tried them out and find them really useful. The problem is my programming knowledge is limited to Matlab so I'm wondering if someone can suggest a macro for the following problem.
I have collected study data and I want to move it all to one Excel spreadsheet. Each sheet has data for on participant, and there are 67 sheets. The sort of macro which would be useful is one which looks in the same five cells (always D36:D40) of 67 sheets and copies it to a specific part of a row in the new sheet (AKx, ALx, AMx, ANx, AOx where x is the next row down, starting from 3, for every sheet data is copied from).
I feel by code being provided for my specific situation it will be easier for me to understand what the code does and thus I can slowly start to learn some macro code.
You don't need a macro for that. You can just include the file name in the cell referencing.
The formula looks like this:
='file:///C:/[path and filename].xlsx'#$'[sheetname]'.G22
The easiest way to accomplish this is to have both sheets open. In your main sheet, type the "=" and ALT-TAB to the other sheet, click on the cell you wish to reference. Hit return. The value from that cell will appear in your main sheet.
So your main file, can point to those 60 some-odd sheets, and whatever cells you want. Any time you update those files, your main sheet will always be up to date.
I have a .xlsm workbook used as a template (I am using Excel 2010) to create a workbook when users wish to download via a website.
A copy of the template is made when a download is attempted and values are written into a lookup tab in the copy (there are 2 columns: name and id) via .NET code. This part works great.
There is a second tab that uses a COUNTA formula to determine how many rows of data are populated in one of the columns.
My problem is that the COUNTA formula is showing a value of 0 instead of the correct value when the workbook is opened and macros have run. If I were to manually enter the field and refresh the value the value will be correct.
The formula is:
=COUNTA(LOOKUP!A2:A1000)
Why doesn't this work and what can be done to make it work?
Hello Here is a pretty fast way to count all of the Cells in A
Sub btnCount()
Range("A1", Range("A1").End(xlDown)).Select
MsgBox Selection.Count
End Sub
I admit to not being very technical and my limit up to now has been using paste links to connect data between sheets. I now have a requirement I cannot figure out.
I have 2 workbooks I wish to automate sharing data between.
Workbook 1 contains multiple rows of data manually entered.
I need a button against each row so when it is pressed data from certain cells on that row in Workbook 1 are transferred to cells within a worksheet in workbook 2
I would be very grateful for any guidance on how to achieve this.
Many thanks!
Though you can deploy VBA to achieve this, but the same is also possible with simple formula like.
=[1.xlsx]Sheet1!$A$1
Lets say you have two workbooks 1.xlsx and 2.xlsx and you want sheet1/column A1 value from 1.xlsx to be auto populated in sheet1/column A1 in 2.xlsx, you can simply link it with a formula like =[1.xlsx]Sheet1!$A$1 in second workbook 2.xlsx.
So as soon as some entry is done in first cell, second cell is auto populated
However if you are looking only for vba solution do write back
I have a workbook with two sheets. The first is full of data and calculations, the second is mostly cells with references to the first sheet. The second sheet also concatenates strings, and references to cells in the sheet, to form SQL commands used elsewhere.
There is also a second workbook (soon to be more). It has a sheet identical to the first sheet of the other workbook, except with different data. The problem I'm having is that the new workbook needs a sheet similar to the second of the original workbook (sorry if this is sounding confusing). I would like to simply duplicate the sheet and its formulas, which I tried using the 'move or copy...' option. Unfortunately, the formulas in the cells reference the first sheet from the old workbook, like this: =[foobar.xlsx]data!A1. Way too much data to remove them by hand. I can't just redo the formulas because I had to remove a lot of specific lines from the second sheet, so dragging the formula would not match up correctly. I'm currently trying to hack this together with REPLACE but if anyone can offer help it would be greatly appreciated.
CLARIFICATION:
When I copy the sheet, a formula will appear as =[foobar.xlsx]data!A1. I want it to just be data!A1.
Thanks :)
I hope this answers your problem, but I am a little unclear on your need!!!
Highlight all cells in the worksheet.
Perform a replace to replace = with say '=
This stops the formulas "being formulas"
Copy the sheet.
Perform another replace on the new sheet to replace '= with =
This converts back to formulas, referring to cells in your new workbook.