Think I might be reaching a bit here, but I’m trying to find a way of sending / submitting cell values in excel to other cells. Here’s the example;
In a cell I have a car name
I’ve set my workbook up to use this cell as a field to enter data and the system calculates where what I enter into a separate table, and returns a confirmation that the car I want to look for exists. I might then delete the data in the field to repeat the search. Here’s what I’m trying to solve…
If the car doesn’t exist, I want to somehow send or copy the data from the field (by clicking something or a formula) and send it into another table automatically to list as “cars that were searched for but didn’t exist” type area, how could I do this?
Many thanks
Related
Background
When the Pivot table seems to have a custom NumberFormat, the created fields will not carry it.
OffTopic: I guess it is normal, sometimes it displays 2, 3 or 5 digits among the same dataset, this is for convience for the user (thus making each cell in the column likely to have a number format different from each), I am not really able to change it, there is another ruling that basically formats cell by cell on the source data (I know it's not ideal, but it is what is convinent for the user and avoids overflooding the workbook with conditional formattings).
I would like to keep that number formatting on the value field when the user adds it to the PT by dragging that field to the Value field.
Problem
I have not found the right event to detect when the field is being added to the Pivot Table, I have tried all the events related to PivotTables in the worksheet, but even by reading to their inputs, I can see that such event may not exist.
Question
Is there an event that detects the field adding?
Further thoughts
I am not quite sure if it exists, my alternative would be to create a button where the user would get the format from the original source by clicking it by using the same code that I use to format cell by cell, but I would like to this be ran automatically when the Value add happens.
I currently build a dashboard in Excel to track forex trades. One worksheet is for adding new trades to the database. Within this worksheet i have several fields that the user needs to fill in order to add the trade to the database. Now I want to avoid that the user inserts wrong data (regarding format) in the cells and therefor crashes the outputs from the database later on.
How can I define such criteria via VBA? For example the field date to have the format YYYY-MM-DD and the field Trading Volume XX,YY so the user can't (accidentally) insert X,YY etc. For dropdown fields it is easy by defining the inputs within the dropdown menue itself, but i need some solution for the manually filled cells.
I will then define a msgbox to pop up and inform the user to meet the required input formats.
Thank you very much in advance!
Some key words would help me, I can then get into deeper it and code it by myself.
Rather than using code could you not use data validation and force entry of a date, numeric value etc.?
If you define the cell format to be custom 'yyyy-mm-dd' then apply data validation with a defined date range Excel will auto format it for you even if they enter dd/mm/yyyy and alert if an invalid entry is added.
Then for a belt and braces approach run a routine at Save that will mimic what your database will do and alert if there is still invalid data see https://learn.microsoft.com/en-us/office/vba/api/excel.workbook.beforesave
I would also lock down the sheet to avoid users adding rows / columns or moving your cells around.
enter image description here
I am creating a user form for work where the user can select up to 15 clients from a list using excel data validation. However, I only want the second cell to be available to populate once the first has been populated, and the third when the second is populated etc. I also want the color of the cell to change when it becomes available to populate
I've tried using regular excel data validation and conditional formatting, but it seems limited in that I would have to create a separate data validation for each cell, rather than making one data validation command for the entire range
I would think using an if(IsEmpty) would solve my problem but as a fairly new VBA user I am having trouble determining the most efficient way to incorporate the list data validation into the general entry restriction.
I'm trying to implement data validation in Excel using VBA. I'm able to implement data validation before save excel event but I'm having trouble in finding range, where user gave the input in excel.
For example, I want to implement data validation from A1:C50 but if user enters data from A1:C45, remaining cells will fail due to validations. SO I want to find range A1:C45 and do validations.
Can you please let me know how can I find user data range in Excel?
If I am understanding your question correctly you only want test the data if the row above it has been filled in. If so, you can do this without VBA. In your data validation select 'Custom' and enter the formula below (example for cell A46):
=AND(A46>0, A46<=10, COUNTBLANK(A45)=0)
This will check for a value between one and ten but only if there is an entry in the row above.
If this doesn't help please provide more information around your question.
I have an Excel 2010 data table which is driven by a query from MSSQL. The underlying query changes depending upon what options the user selects in the Excel workbook. I'm okay with changing the query and pulling the data.
After the data has been selected multiple users will be able to edit and append data to the Excel table and these changes will post back to the SQL database table. Due to the database table structure some of these cells within a given row are mandatory before any data can be inserted into MSSQL and/or potentially updated.
So what I'm trying to achieve is checks on whether certain columns in a row are blank after a cell is edited (I can do this via Worksheet Change) and also before they move off that row so I can bring up a message if all mandatory columns haven't been entered. I can't see any events that fire before Selection Change. My only thoughts on a workaround is to have a global variable row marker that is updated on Selection Change, i.e. it will store the previous row number. I can't use Excel's standard data validation functionality looking at blank cells because although this is fine for a currently correctly populated row that is being edited, inserting new rows or appending directly to the bottom of the table will constantly error as all those mandatory columns will, of course, be blank. Currently I am using conditional formatting to at least highlight columns/cells that require input although this doesn't force users to actually do it. Data cannot be stored within MSSQL until these columns contain data so if they don't fill them in and refresh the table for whatever reason, whatever they have entered will be lost. Obviously this is bad, m'kay. I am concerned about both the Worksheet Change and Selection Change events constantly firing and how that will affect workbook performance.
Any suggestions would be appreciated. Maybe I'm going about this all wrong so any ideas to make this more efficient would also be well received. The user base do not want to see UserForms or MS Access even though it would make this activity very easy. They are too used to the look and feel of Excel sheets.
your best way is to copy the table into 2d array or some other data structure in memory such as dictionary or collection. and than manage each change in memory. this one is very efficient but requires a lot of code. with excel the only problem you have is the key the rest is vlookup and true false questions. vlookup will find the original value and then you have current data + previous data + the logic... is the new data ok?