I have a Gridex with one column as a link column. When a user clicks a link the event triggered should then store several values from the selected row in several different variables.
I suppose the values could also be stored in the same variable if necessary. I do however need to get several values from the GridEx, getting just the value of the clicked link isn't going to work for my use case.
I'm sure it's a simple one liner but I can't find a solution.
So I've found an answer to my question. This seems to work for me
Dim Row1 As Janus.Windows.GridEX.GridEXRow
Row1 = GridEXSORCodes.CurrentRow
frmGeneric.Var = Row1.Cells("Column").Value.ToString
frmGeneric.Var = Row1.Cells("Column").Value.ToString
Related
I would just like to say that I'm very new to VBA and more complicated formulas so all the help will be appreciated! Thank you!
To clarify a bit more with the title. I currently have a Macro that is reading a formula to give me information from another worksheet. I'll give an example of the formula that is working:
=IF(A2 = ""No Specific Program"", A2,IF(F2 = """",""No PIN"",IFERROR(VLOOKUP(CONCATENATE(A2,F2),....!$C:$I,4,FALSE),""NO DATA"")))
This is the original formula that I'm using to get the information, column A is my Parts owned by Program, And my column B is the actual Program. So when I run the Macro it does give me most of the information, but when it runs into "No Specific Program" even when there is something for Column B showing what program the part is in, it will give me No specific Program.
Also for reference the F2 it is Concatenating is a PIN number which will help determine who owns the part.
I've been stumped on this trying to get the code to work and I've tried place THEN and ELSE within the statement and it just gives a FALSE statement
EDIT:
The Code above works, it's when I use this version of the Code:
=IF(A2 = ""No Specific Program"",THEN,IF(F2 = """",""No PIN"",IFERROR(VLOOKUP(CONCATENATE(A2,F2),'.....'!$C:$I,4,FALSE),""NO DATA"",Else,IF(A2 = ""No Specific Program"",THEN,IF(F2 = """",""No PIN"",IFERROR(VLOOKUP(CONCATENATE(A2,F2),'.....'!$C:$I,4,FALSE),""NO DATA"")))))
I get the False or errors when I try different variations. Here is an example of the columns. Column A is where I have the original formula reading from, but then it says No Specific Program, while Column B shows the Program. So I'm trying to get the formula to read that as well as column A to capture all the information I need :
Columns Example
EDIT:
It starts breaking after the ELSE statement.
Edit:
=IF(A2 = ""No Specific Program"",
IF(F2 = """",""No PIN"",IFERROR(VLOOKUP(CONCATENATE(B2,F2),'\NW\Data\TechIntegration\Sustaining
Team\Data
Mining\DataMining[GAD_PIN_TABLE.xlsx]Sheet1'!$C:$I,5,FALSE),
""NO GAD
DATA"",
IF(F2 = """",""No
PIN"",IFERROR(VLOOKUP(CONCATENATE(A2,F2),'\NW\Data\TechIntegration\Sustaining
Team\Data
Mining\DataMining[GAD_PIN_TABLE.xlsx]Sheet1'!$C:$I,5,FALSE),""NO GAD
DATA"")))))
Just trying to make it easier to see the formula.
I'd split this down to make it simpler to follow, use a holding cell then refer to that in your top formula (The one you know works already)
Stick this in another column, say Z for example, then everywhere you refer to A2 in your working formula, change it to Z2
=IF(A2=""No Specific Program"",IF(B2=""No Specific Program"",""No Specific Program"",B2),A2)
This will only give you "No specific program" if both a2 and b2 contain "No specific program" which I think is what you're after. In your second example in the columns example link, it will return NG
I'm trying to copy a row, columns A-J, representing a person and associated info, when column J is filled. I'd fill it with either w, x, y or z based on the reason people are away, and I'd like the row (A-J) copied to another sheet as soon as J is filled.
Here's a screenshot with both Excel documents. Please ignore the "Reason" column in the Pers sheet - I know it could be used, but my production one doesn't have this column, and will not. I just used it to illustrate for you guys.
That other sheet (Main) has headers, as you can see, for each reason why people would be away. This one would permanently be displayed on a big-screen TV. So, what I'm trying to do is :
Copy the rows to Main as soon as the "Departed?" row is filled in Pers;
Make sure those rows go into the proper category, in the first blank row;
Ensure each category remains collapsible.
You can see I've tried using the If function (syntax in screenshot). That worked OK, but :
Left blanks;
Biggest one : only worked row-for-row! (Also the cause of reason #1, I suppose...) Past row 11, nothing. Not too sure what to do about that...?
Hope this is somewhat clear? =) Let me know if you have any questions - thanks for your help!
I have a simple dropdown list named DD8. It uses 50 rows as control, the problem is that for now only 45 rows are used. That means that in the dropdown list there are 5 empty rows. The problem is that if someone select one empty row, or don't select anything (default is empty) the fallowing code will show error :
With Worksheets(1)
NameProf = .DropDowns("DD8").List _
(.DropDowns("DD8").ListIndex)
End With
I tried things like if .DropDowns("DD8").List (.DropDowns("DD8").ListIndex) != "" but ofc, it shows error. I searched how to select only used rows with the DropDown list of the development tab but it doesn't seem to be possible.
I have to select 50 rows because new customers can be added.
Do you know how it can be achieved ?
If new customers can be added, then I imagine, and hope for you, that it goes above 50.... so it's not just an issue of having 5 blanks for now to not be an option, but also allowing customers 50-2,483 also be on there when they come along. ---- Without more details on your code, I believe this suggestion should help 'guide' you but not immediately solve your issue.
Essentially, whenever you call to have your dropdown populated, you want some code to find the last row of data in the customers column, and then assign your dropdown to populate with the starting row of your customers to the lastrow. This way no matter how many customers you have 2, 48, 189... they will show in your dropdown without that issue occurring. A simple google search will yield how to find the last row in excel.
Sorry I couldn't just bust out the code to make it work for you right this second, but I think this should be a good starting point for you.
Using Excel, lets say I have a validation list made of 5 values like this one :
Patate
Tomate
Courgette
Concombre
Patate
In a cell containing a drop down list made of these 5 value, I select the fifth value : "Patate".
I want to get in VBA that this cell contains the 5th value of my validation list. Something like :
x = Cell.Validation.GetIDValueSelected
x = 5
I can't use Vertical search because I might have 2 or even more time the same value in my list (too long to explain why).
This list is also dynamics (depending of another sheets) so it doesn't always contains 5 values.
I hope I made it clear for everyone to understand my needs but I will be glad to add more information if needed.
Thank you for your time.
Sadly, once you have used DV to fill a cell with junk, there is no way to tell which piece of junk you picked:
You would have to pad each piece of junk with a different number of blanks.
This is code from Excel 2010. All of the code resides within the workbook itself. Information is gathered using internal forms and the code is run.
I have code that retrieves data from a spreadsheet and populates an object with that data. The row number is dynamic as it is dependent on the form input. The column is by the header, not the column number. The following code works perfectly but for two anomalies:
cTank.RowForTankSpecs = rNum
cTank.MP = .Cells(rNum, Range("MP").Column).Value
cTank.Form = .Cells(rNum, Range("formName").Column).Value
cTank.TankProcess = .Cells(rNum, Range("Process").Column).Value
cTank.Location = .Cells(rNum, Range("Location").Column).Value
cTank.TankName = .Cells(rNum, Range("Tanks").Column).Value
cTank.tankID = .Cells(rNum, Range("TankID").Column).Value
First:
The cTank.TankName is retrieving information from a column named "Tanks". That column does not exist. The actual column header is "Tank". But, it is retrieving the correct information. If I change the name to what it really is (Tank), it does not work.
Second:
When the cTank.TankID line is executed, I get the following error on the Range("TankID"):
Runtime Error 1004: Method 'Range' of object '_Global' failed
This one has the appropriate header (column header), but it is not recognizing the range.
I have tried simple things such as changing the order of the code, but it doesn't help. As earlier stated, the other lines work. Later in the program, information is gathered in the same manner but using another worksheet from the same workbook, and none of them are working. I've double checked that strings are strings and integers are integers, etc. I've double checked the column headers match the range names. Nothing seems to jump out at me.
I would appreciate any input you may have on the situation.
Thanks in advance.
Steve
Ok. Being pretty sure my code was correct, I went to the spreadsheet itself. For some reason it was recognizing only certain columns and it was recognizing one of them incorrectly. So I started highlighting the columns that worked and also the columns that didn't. What I noticed was that on the columns that were being recognized, that column header was displayed where the cell location is normally displayed whereas on the columns that were not being recognized, the cell location (i.e. A1, A2, etc.) for the header was being displayed and not the header title itself. The incorrect label was showing up for one of them. As it turns out, the mislabeled column was one that I had used for a form dropdown menu. So, I checked the name manager, and the ones that were working were listed. So anyway, using the name manager, I added named ranges using the headers. Now, when I select the columns, the column header(named range) appears in that window and now, the code works.
Thanks guys for your input. I really appreciate it.
Two things you can do:
Do not use use Range, but as it seems you are using names, use Names("Yourname").Referstorange.
OR
Make sure your names are set up correctly using the Name Manager in Data Ribbon.