Making use of selected or clicked cell without VBA - excel

A tricky one, I assume. However, is there a way to make use of a selected or clicked cell in Excel somehow without the need for VBA?
(I know how to do it with VBA, but macros are macros, but if you want to give workbooks to people...)
For instance, I would like to make some of the content in the freezed section to be dependent on where in the sheet someone is. It would be optimal, if the selected cell/row would be trigger enough.
It would be also okay, if clicking a cell (e.g. a link navigating in the sheet) would trigger the conent to change. Hence, a solution would be to make a hyperlink change a value in some cell somewhere. I know, this is a different question, but it should be all accomplishing the same goal of the line on top ;-)
Thanks a lot!

You cannot change values or display of another cell with formula or functions.
The hyperlink will send you to another location but won't change the freezed part, except if you only freeze rows and the hyperlink send you to a further column. But you will have then to really think about your layout very precisely. Moreover, the user will even less understand what happens unless you can design a great UI (but Excel may not be the best tool though).
Some tips:
Use hyperlinks but on differents sheets
Use "transparent" macros (without big buttons but rather event vba as you pointed out)
Sorry i don't have a magical solution.

Related

Excel-VBA Get Code of the design of existing cells

For an application of protocolling some measurements and therefore made a design for the print out of the data. This is a fairly complex design with many highlighted area, marked cells, font size changes, background color, pictures and so on.
My question is: Is there any way to get the design as a VBA code to "store" it without doing it all manually?
I already tried around some with the macro, though I couldn't "read" the current cell design.
Thank you in advance
You could save your empty templates on hidden sheets and copy the required on to the "print" sheet. Storing all of the formatting in code will be difficult to manage unless it's very basic formatting.

Is it possible to assign a value to a cell when saving an excel file?

The point would be to automatically keep a "last" value (without, the human-error-prone: "just remember to do it" method), so that when changes are made the next time the spreadsheet is updated, they can be easily compared.
Update:
I'd still prefer to do this without macros, if possible.
But, since that's apparently not possible; what would the macro look like to do this?
How to place excel VBA code on save event
You can use an event trigger. I think you have to have a macro. You're basically asking this to be automatic - which means having to code something to do it for you. Using a spreadsheet formula would mean it will display current values... it wouldn't stick to the last value.

vba excel: How to fill in two cells in a row with text

I need to make a header in my excel sheet using VBA. Seems pretty simple, but when I do this
Worksheets("New_Students").Range("A1").Value = "studentID"
Worksheets("New_Students").Range("B1").Value = "ISUID"
only the first line works and not the second one. What am I forgetting?
Try this:
Inside the excel application go to the developer tab on the ribbon and click record macro.
Type the values into the two cells manually.
Click stop recording and view the macro it created.
This would show you VBA code that will work and you can compare it to what you have in order to trouble shoot.
This is called recording a macro and can be very helpful in solving problems. In fact I would suggest doing so almost every time before asking a question here.

How to detect a cell is selected for editing in excel

I have a range of readonly cells.After that all other cells are editable.I want to know how can I detect this cell editing event.Like if cell A25 is edited,I want to call a procedure.
If Cell(A25).edited then do this.Some thing like this
You need to use the Worksheet_SelectionChange event as highlighted in my answer to one of your other questions.
May I suggest that now would be a good time to go and learn a bit more about Excel events and what you can and can't do with them, rather than asking multiple similar questions?
The following links may help:
http://www.cpearson.com/excel/events.htm
http://www.mvps.org/dmcritchie/excel/event.htm
http://www.ozgrid.com/VBA/ExcelWorkbookEvents.htm
Though i'm not sure if you can trigger this modification event somehow with VBA, I think there's better way to handle your read-only cells. Set them as protectable in cell format window, and then protect your sheet. After that everybody would be able to edit all the cells except the ones you marked as protectable.

Create a new sheet for each row

In an Excel sheet, I have roughly 30 rows x 100 columns of data. Each row represents a different "client". For each client, I've create a summary sheet that is emailed to them and that also contains all the information from my main sheet
Is there a way for Excel to create a new sheet based on some template sheet when I add a new row to my main sheet and fill it with the appropriate data?
I will give you my opinion about your need, the way I see it, at least. It is not a "ready to use" solution, however, only some ideas about the way to do that.
From what I know, there is no way to track insertion of a row in Excel. So you would require a VBA function to be activated on a button, for example. Actually, there is, see Lunatik's answer.
This function would loop over all rows in your main sheet, and create a new sheet when necessary (you would need preferably a unique id for each client, it could be a simple index on the main sheet, depending on the line).
You would create at first your template sheet, with a specific name, and eventually hide it (to not have it in the visible tabs). When I say that the function would create, it would in fact copy this template sheet and give it a unique name (the id I mentioned earlier). You can find ways to copy sheets at this link.
A second operation to do, would be to put data from the row in the main sheet, to the template sheet (if I understood correctly your requirement), which is not really complicated to do in VBA.
If you need this to happen automatically on the addition of a row then you would need to use the Worksheet_Change event to capture the completion of a new row.
This would then generate a new workbook from the template, copy across the necessary ranges then save the new file somewhere, much as Gnoupi says
All this is relatively trivial with VBA, but unfortunately if you aren't familiar with VBA then isn't a simple case of "Do X then do Y in Excel" so I think you may struggle, even with sample code posted here.
Even if I created a dummy model that did what you require, functionally at least, then customising it to your particular needs may difficult if you are not used to working with Excel programmatically.
Edit
I've created a very simple demonstration of how this could work: http://drop.io/4clxof3 - note this example doesn't include the event handling for adding a new row, has almost no validation or error handling and makes sweeping assumptions about almost everything(!)
If you feel comfortable using this a basis for developing your own solution then great. If the whole VBA thing is foreign to you then it may be time to call in reinforcements :)
i was wondering if it was possible with no error catching. Simply just have a VBA code that takes each row of the Excel Document - Creates a file for each row and then at the end combines the total files in a folder into one?
I know sounds weird.. but is this possible?

Resources