Set Cell Values From Visual Elements
Jan 16, 2008
I'm using excel worksheets to design a form (not a userform) to be used on a touchscreen tablet pc. Often this form will be used to count various objects or observations. For user-friendliness and ease of use, I wanted to provide a 1-click way to enter a text or numeric value into a cell.
There are somewhat standard values that need to get entered (yes/no; yes/no/unsure; 1-5; 1-10; etc.); however there are certain instances where I want to be able to modify the values to be entered. (i.e. 1-10, with ability to apply +10... so they then become 11-20).
There are many questions, and I want to reuse the 'component' and code to be able to assign a value to a cell based on clicking a visual element. The visual element containing the value that was assigned in the cell should also change color to indicate that it is value that has been selected.
For the sake of helping to reduce possible back-and-forth elaboration and eventual proposed solutions in this thread, I'll quickly describe the implementation I tried to adopt, but which has led to issues.
These requirements led me to think that some representation of a button would be necessary; and I tried using grouped textboxes. I got it working well, but then performance crapped out once I started protecting/unprotecting the sheet (as excel doesn't allow reading the value of a grouped textbox, i had to do a build shape-range / ungroup / loop thru shaperange / regroup).
Dave suggested that groups are perhaps not necessary, so I've created this thread. Any/all suggestions welcome. See attached xls file for an example of where I've gotten so far (i.e. this is functionality I want to have, but perhaps a different implementation (non-grouped?) would be possible, which does not suffer from performance issues once incorporating protection/unprotection of a sheet)
View 6 Replies
ADVERTISEMENT
Oct 17, 2007
I am trying to compare the values in an array with the values in a range of cells. It worked fine until I moved the code into a sub. The specific problem that I am having is that is pulling cell values from "shippablegoodspriorday" and it is supposed to be pulling the cell values from "shippablegoods".
module1
Call compareSheets(priorShippable, Sheets("notfound"), Sheets("variance"), Sheets("shippablegoods"), [A:A], 11)
module2
Sub compareSheets(goods() As Variant, WS As Worksheet, WS2 As Worksheet, WS3 As Worksheet, col As Range, offset As Integer)
With WS3.............
View 2 Replies
View Related
Nov 22, 2013
I have 10 graphs with more than 20 legend entries. However, each graph only needs 3-4 elements out of the 20 legend entries in the graph. Is there any way to force Excel to only show those legend entries that have a value? (without deleting them manually)
View 12 Replies
View Related
May 3, 2008
I create a dynamic array. I want to output all the values in my dynamic array in separate rows.
MsgBox ("the values of my dynamic array are: " & vbCr & _
myarray(1) & vbCr & _
myarray(2) & vbCr & _
myarray(3) & vbCr & _
....
myarray(i))
View 5 Replies
View Related
Jun 3, 2006
I would like to do is develop a stand alone program in Visual Basic ( not in Excel VBA) to update the price file in our Portfolio system automatically using the downloaded Excel format file csv extention file from the BigCharts. But before that, I need to export the *.pri file from our Portfolio system in to Excel which still saves as *.pri extention. Then once it updates, I import the updated *.pri file back in our Portfolio program. I understand that the Excel VBA code can be incorporated in Visual Basic code provided there is an object declaration for Excel file (In this case eventhough the both files are in Excel format, they don't have xls extention). how to use external files and Excel VBA code in Visual Basic?
Below is the code that I currently have in Visual Basic. What I'm trying to accomplish is using the ticker (eg. msft) as a keyword search to look up in the price file. If found , the price of that ticker from the test.csv file will be copied in to the price file which is test.pri. I haven't ran it yet.
Sub UpdatePrice(BigChartPath As String, BigChartName As String, AxysPricePath As String, AxysPriceName As String)
'Below are Excel VBA codes
'Uses the test.csv to look up tickers in test.pri and update the price in it
Dim PriceFile As Workbook, BigChartFile As Workbook
Dim PriceFileSheet As Worksheet, BigChartSheet As Worksheet
Dim MaxRows As Long
Dim PriceFileRow As Long
Dim BigChartRow As Long
Dim BigChartFound As Boolean
Call CheckBookOpen(BigChartPath & BigChartName)
Call CheckBookOpen(AxysPricePath & AxysPriceName)
Set BigChartFile = Workbooks(BigChartName) 'Big Chart website imported CSV file saved as test.csv...............
View 5 Replies
View Related
Mar 23, 2008
I have a cell that contains parts that are comma separated. I want to assign each of these parts to an element in an array so I can process them using a loop function.
Example Cell A1 = t4567, g8905, z3030
partArray = (t4567, g8905, z3030)
Is there a method or function i can use to achieve this?
View 9 Replies
View Related
Aug 20, 2008
I have a cell that I do no want anyone to enter any information into unless a previous cell has "U" inside of it.
Okay so so I have a column of cells named "Fringe Benefit Type" you can choose different letters to corropand to different types. Now I have set the letter "U" to be the one I want and that works. Now the next cell is called "Hire Season". Now (stay with me here) IF "Fringe Benefit Type" is equal to "U", I don't want the user to be able to enter anything into "Hire Season".
I am using the visual basic thing, which already has some code, but I am not understanding it too well.
View 14 Replies
View Related
May 2, 2008
I'm trying to get a code that will do the following: I've got a list of stocks followed by extra information in de columns to the right of it. If, based on that extra information you'd like to know more about the stock, I'd like the user to just select the cell that holds the name, and click a button.
What this button should do is the problem for me right now: it needs to select the cell left to the one selected holding the name of the stock.
The cell to the left holds the code that is used to lookup information in Bloomberg. This cell is invisible to the user since I hide it to make the tool look good. How do I write a piece of code to select for instance: B10-1=A10. The rest is just a recording job.
Also, I know you can add text to the text in a cell, however in this case I want to cut some text. Is the any way to get: "B10-1"-"equity sedol1", leaving me with the text in A10 minus equity sedol1?
View 9 Replies
View Related
Mar 13, 2009
I have a report as below:
Cust IDCust NameAcct 1Acct 2Acct 3…Acct 10…Acct 100Total123AB 123 255 663 - - 1,041 456AC - 3 833 51,008 - 51,844 157AD - 46 46 550 - 642 226FE 5 7,733 - - 553 8,291 658FZ 9 8,833 - 444 555 9,841
and would like to get the final product as following:
Cust IDCust NameAcct 1Acct 2Acct 3…Acct 10…Acct 100Total123AB 123 255 663 - - 1,041 456AC - 3 833 51,008 - 51,844 157AD - 46 46 550 - 642 226FE 5 7,733 - - 553 8,291 658FZ 9 8,833 - 444 555 9,841 Total Region 1 137 16,870 1,542 - 52,002 - 1,108 71,659
Criterias:
# of Rows are variables.
# of Columns are variables.
Sum amount for each of account including total per customer ID.
Total region line is hilited and bold.
View 9 Replies
View Related
Jan 8, 2009
Dim struserID As String
Dim strPassword As String
Dim strUploadFile As String
Dim strQueryURL As String
Dim objIE As SHDocVw.InternetExplorer
Dim htmlDoc As MSHTML.HTMLDocument
Dim htmlInput As MSHTML.HTMLInputElement
Dim htmlColl As MSHTML.IHTMLElementCollection
Set objIE = New SHDocVw.InternetExplorer
struserID = "xxxxxx"
strPassword = "abcdef"
strUploadFile = "C:Misc estupload.txt"
Code navigates to sign on page, enters userID and password, clicks on submit. The password used causes upload page to load. This all works ok. After upload page is loaded, the code does not enter either of the two following "for" routines.
View 8 Replies
View Related
Jul 22, 2014
I have a few hundred of these divs, that I need sort and filter.
I would like to remove ALL HTML and be only left with the following:
Example Name = KeithEmail = keith@example.comStore = Store 1 (This only has 2 options. Store 1, Store 2)
All of the below code is in an individual single cell, so there are about 400 cells
HTML Code:Â
<div userid=""286"">
<div id=""694"">
<h1 style=""display:none"">Keith</h1>
[Code]....
View 1 Replies
View Related
Dec 11, 2008
If I have say several hundred elements stored in an indexed array and I want to clear them each time the sub or function holding them is called, is there a way to erase the contents of the entire array without having to loop through each element.
Something like array().clear? Note that each time the sub is called, they are also redimed to some reference.
View 6 Replies
View Related
Dec 23, 2008
I have a STRING array which is dimensioned with 100 elements possible. What i want to know is how to determine the "length" (not sure if this is the right word) of the array. For example: Suppose i have 10 strings in the array. Is there a command to determine that there are only 10 elements in the 100 possilble array?
View 11 Replies
View Related
Apr 26, 2009
I can't seem to get my head around the simple issue of assigning a range of cell data to an array! Here is a snippet of what I have, maybe you can see the flaw:
View 8 Replies
View Related
Sep 8, 2009
I was wondering if there is a way to have the elements of an array counted. I have something like this:
View 6 Replies
View Related
Nov 10, 2009
I've been teaching myself VBA for the purpose of processing some time resolved data from an instrument. I've come up against a problem and I just can't work out why the code is failing. (using excel 2007, VBA 6.5)
I declare some arrays as dynamic, then ReDim them to a user defined number (with Option Base 1) and input data from a spreadsheet into the array. I can then output the data into the spreadsheet again and the lbound and ubound functions return the correct values for the array. What I cannot do is actually access individual elements. If I specify array(i) I get the "Subscript is out of range" error. The code relevant to this problem is as below (simplified as there are more arrays):
View 5 Replies
View Related
Nov 3, 2011
I need to find top/bottom N elements in a range. I have created an array out of the range. I am not sure how to find the top/bottom elements? LARGE function would give me the actual value, however I am interested in finding the indexes.
View 3 Replies
View Related
Nov 22, 2011
Writing macro for "Removing duplicates with less elements in a row."
I am trying to remove duplicate entries from a file based on the number of data present in a row. Please see below
Example:
Name Col-1 Col-2 Col-3 Col-4
abc 1 3 4
abc 1 2 3 4
abc
abc 1 4
I want to retain the row with maximum elements(row 2 in above eg.).
Result should be:
Name Col-1 Col-2 Col-3 Col-4
abc 1 2 3 4
Currently I am doing this manually, by adding countA at the end of each row, then arranging them in descending order. That will make sure that the row with more data comes first n hence gets retained, while other rows gets deleted.
Can this be done using Macro?
Below macro just deletes the rows,
Public Sub DeleteDuplicateRows()
Dim R As Long
Dim N As Long
Dim V As Variant
Dim Rng As Range
On Error GoTo EndMacro
Application.ScreenUpdating = False
[Code] .....
View 5 Replies
View Related
Jan 21, 2012
I have a question regarding arrays. If I have too many elements in a 1D array(let's say 1000), how can I list all of them in a msg box (separated by comma)?
View 2 Replies
View Related
May 14, 2013
I am facing the some issue while tried to display the data from array. Below is code I have to tried to display the data from array.
Scenario: I have assigned the few values in my excel to an array and tried to display the data stored in array
Sub Main()
Dim Rows_Array() As Variant
Dim i As Integer,
Sheets("EmployeeWise").Select
Rows_Array = Range("C6:C" & Range("C65536").End(xlUp).Row).Value
For i = 1 To UBound(Rows_Array())
MsgBox Rows_Array(i)
Next
End Sub
View 1 Replies
View Related
Nov 19, 2008
I have a column with serial numbers, i want to go through that column and store all the unique serial numbers and the number of occurrences. then i want to know what is the highest occurrence.
View 9 Replies
View Related
Sep 1, 2007
I am trying to present a 10X10 Matrix Range (A1:J10) full with UNIQUE INTEGER random numbers. I thought to use an Single Dimension Array (100 deep) and fill it with the Rnd() Function.
Then, I thought to check the RANK of each element of that Array and transfer it to 100 cells (10X10) in the Sheet (assume A21:J30) with the help of 2 nested loops.
My problem is: How to find the Rank of each element within ARRAY1. Is there a way to refer to an Array as to a Range in a Worksheet. (I do not want to transfer 100 values from the Array to the Sheet - I rather prefer to check the Rank WITHIN(!) the Array).
Option Base 1
Sub MiKe()
Set AWF = Application.WorksheetFunction
H = 10
V = 10
Redim Array1(H * V)
For CL = 1 To H * V
Array1(CL) = Rnd()
Next
For HC = 1 To H
For VC = 1 To V.........................
View 2 Replies
View Related
Jun 20, 2008
I've used Rob Bovey's Chart Labeller a lot recently, but this morning when trying to add some labels, I get the error message
"Unable to get the Name property of the Series class (bGetSelectionIndexes())"
Is there a limit to the number of series it will work with?
View 6 Replies
View Related
Nov 18, 2007
I am using my spare time to learn how to create macros (for the first time) in Excel and Powerpoint in order to the use the programs more efficiently (since I spend way too much time on the them
I am SOOOO confused as to what the scoop is with VBA vs. VB net vs Visual Studios? Is there an expert that can provide me with some guidance given that this is the first (and probably the only) time I will be learning a programming language for Excel & Ppt
Here are my questions:
1) Which programming language should I invest my time to learn if you were in my situation? This is complicated by the fact that most corporations do are not using Office 2007 and (from my experience) are utilzing Excel 2003
2) If I choose to learn Visual Studio or VBA 2007, will my knowledge of the language enable me to use VBA in Excel 2003?
3) If I create a macro in (for eg.) excel 2007, will it run in excel 2003?
View 9 Replies
View Related
Jun 7, 2006
Can I enter any record through excel in Visual Foxpro Database without having source code.
View 12 Replies
View Related
Aug 17, 2012
I'm trying to populate a ComboBox or ListBox with elements parsed from a html code I've already parsed from a webpage. Explaining: I was able to extract from the webpage code the part that contains the information I want, which is:
VB:
<li><a href="/universidad/" rel="*">Universidades</a></li>
<li><a href="/universidad/duoc/" rel="28184">DuocUC</a></li>
<li><a href="/universidad/inacap/" rel="28162">INACAP</a></li>
[Code].....
Now I want to make a ComboBox containing every university as a different option and, if possible, to assign them the corresponding values shown in the code.
View 1 Replies
View Related
Mar 1, 2009
I have a named range, called 'event' relating to cells a2-a200, I have a named cell, 'eventcounter'. I was hoping that I would be able to use the named cell eventcounter in formulae on the cells in the event range rather than having to use the cell address. So instead of having a formula that was something like this, =if(a3= etc etc.
I could refer to the range event and eventcounter. Eventcouter gets its value simply by counting the number of non blank cells in the event range, so consequently - I can only figure out how to address the last entry in the event range in the manner that i wish.
View 2 Replies
View Related
Jun 30, 2014
Join an array with Text elements to create a string that can be Evaluated
So for instance if I have Array("A", "B", "C") and I want to evaluate("=({" & Join(array, ",") & "})="A)"). Is there any way to do this without having to loop or push to a Named array first? I'll even take this evaluate thing if I can do it with text and numbers
View 6 Replies
View Related
Mar 25, 2014
I've defined a string array and would want to use it as a basis for a vlookup. Is it possible to find the elements of the array directly in the worksheet ?So far I've got :
[Code] .....
View 2 Replies
View Related
Dec 3, 2009
Filling all elements of a two dimensional array?. I know that I could write something like:
View 3 Replies
View Related