Altering Variables Without Addressing The Name Directly
Jul 18, 2006
how does one alter a variable without referring to it directly? Eg. One has a combo box (CboPNum) with values from 1 to 20 and textboxes (TxtN1 to TxtN20). Upon selecting a value from the CboPNum dropdown, the background of the corresponding TextBox should be changed. I’ve tried to create something that joins the string “TxtN” and the CboPNum value:
ThisTextBox = “TxtN” & CboPNum.Value
ThisTextBox.Background = Black
But this quite correctly gives the error “Object required”… What do you guys recommend?
View 3 Replies
ADVERTISEMENT
Nov 16, 2008
I want to do is copy data to my working sheet (say sheet-1) from other worksheetx (say sheet-2, sheet-3). That's easy enough, but I want to be able to indirectly address "sheet-2" or "sheet-3" from a cell in sheet-1.
Look at the attachment. The data under cost A, cost B, cost C is from other sheets in the same workbook. I want to able to type in "sheet-2" in the first column and Excel to automatically copy over the data in columns 2,3,4.
I do not want a VBA solution. I know this can be done with built-in Excel functions because I did it before. Unfortunately, I lost that spreadsheet and I can't recall how it was done. I tried using Indirect function, but it returns a ref# error.
View 5 Replies
View Related
Oct 16, 2008
I have a named block, used to sort a list of data. But I names the block one row higher to include the headers, so that inserts at the top row of the data would not fall out of the named range. Then I want to sort the data, but not include the header row.
What I want to say in the sort macro is something like:
cell_range( top_row(Data)-1, Bottom_Row(Data) )
Or, to have two names, with one defined in terms of the other:
Data_sort = Data_big - Toprow(Data_big)
View 4 Replies
View Related
Feb 24, 2014
From the Active Workbook how do I run these commands?
The syntax is way wrong, but will show what I'm after...
Code:
debug.Print Workbook("1990a.xls").Worksheets("Sheet1").cells(20, "A")
Workbook("1990a.xls").Worksheets("Sheet2").cells(20, "A")= "testing"
View 3 Replies
View Related
Jun 8, 2014
Is it all possible to address controls on a user form indirectly?
Thus instead of say
kv=me.textbox10.value
Could you do something like...
i=10
kfield="me.textbox" & format(i,"99") & ".value"
kv=evaluate(kfield)
View 1 Replies
View Related
Mar 16, 2009
I need to ask user to input the row ("rowin") and column ("colin") address in order to activate a cell. The mose natural inputs from the user will be an integer for row and one or two alphbats for column. Say, for example, the user input (82, AY), how do I represent the cell in code? I know I want to say something like Range("AY82"). But I just could not figure out how to concatenate "colin" & "rowin" to make it AY82 to Excel.
View 4 Replies
View Related
May 21, 2013
I have a very large workbook, too big to cut down and upload . In it I have some code which selects a graph and sets the data on the graph to an arbitary number, Unfortunately, I get a "Method 'Xvalues' of object 'Series' failed" error when I run it (although not every time). The relevant part of the code is below. Prior to the code below, different sheets are selected and variables moved around, then this part of the code hides the other sheets leaving the calculation page visible.
The graph is on a log-log scale, but I don't think that is particularly important. The data series are named as various things (e.g. baseline, reference, measurement) though but there are only ever two on the graph (I just rename them later on and change the data).
VB:
'open calculation page and hide survey results and archive pages
With Worksheets("Calculation Page")
.Visible = True: .Select
[Code]....
View 9 Replies
View Related
Mar 31, 2014
I need to modify the following formula,
=IF(G5=-105,-105,-G5-IF(ABS(G5)>251,40,IF(AND(ABS(G5)>221,ABS(G5)<251),30,
IF(AND(ABS(G5)>180,ABS(G5)<221),20,IF(AND(ABS(G5)>=100,ABS(G5)
[Code].....
View 10 Replies
View Related
Mar 26, 2013
I have come across another stumbling block with VBA (new on VBA and slowly taking baby steps). I have a macro that reads and deletes all duplicates on the files i work on. However I need this to read and do the job on 2 sheets at the sametime (sheet 2 and sheet 3). Below is the macro which does work fine on a different workbook. How would I integrate this into my new sheet to do 2 jobs at once?
VB:
Sub delduprows()
Dim m As Integer, j As Integer
Dim n As Long, i As Long
[Code]....
View 1 Replies
View Related
Jun 12, 2014
I have a spinbutton on a userform. Here is the section of code for SpinUp:
[Code]....
Normally, I wouldn't hard code an address in like this, but I was given a last minute project to present on Monday, so it's down,dirty, and quick. Anyways, the adjacent cell "O7" has a formula referencing another page. When I spin the spinner it activates the correct cell (and continues to do so as long as I press the button), but here's the wierdness: cell "07" formula disappears, leaving the existing value in it. It's like it copy pastespecial values.
I've stepped through the code and it's not referencing any other procedure. It happens on this line:
[Code] ....
View 1 Replies
View Related
Sep 4, 2007
In cell AD17, I have a formula that returns the number of days or draws(Skips), since the number in cell AD2 has been drawn. The following cells AD18.......... returns the next skip and continues untill all the hits( AD3), are accounted for. My question, Can the formulas be altered to read a "
View 9 Replies
View Related
Apr 3, 2008
i have on sheet one a cell that requires an order number ( e.g something like j2345a ) what i would like to do on sheet 2 cell c10 i would like to extract the letter after the 4 figures so that what i would see in that cell is j2345.
what i should add is that the letter after the four numbers isnt always an "a" so it could be any letter that needs to be removed
i also need cell c10 on sheet 2 to remain empty if there is nothing entered in cell e8 of the first sheet
View 12 Replies
View Related
Dec 28, 2012
I have a column ful with numbers and would like to add an h (hour) after every number. I found that it is possible for valuta (dollar sign). Is there a way for random symbols that are not in the valuta list?
View 3 Replies
View Related
Nov 12, 2008
I have two tables of information. The first is a matrix with some distances. The second is a table of distribution. Ive been trying this for a long time now with limited success using a truth table but i've realised the only way to do this is in code. Ive got limited experience with this so please point me in the right direction.
Ive written some steps explaining what each table does here -
Step 1Check for lowest value B4:F4 in Table 1 (in example is 10)
Step 2Check corresponding column destination available capacity in table 2 (Example 500)
Step 3Distribute as much as possible from source in table 2 (500)
Step 4Reduce value in capacity line by value taken from source
Step 5If some source remains move back to table 1 and find next nearest column Dest
Step 6Repeat step 2 until all source is gone in row
Step 7 Check for lowest value B5:F5 in Table 1
if run out of capacity at all sites stop code
etc
until Table 1 column B is empty
Ive posted a spreadsheet with some before and after tables in it aswell. Its very small and formatted o its easy to see whats happening.
View 14 Replies
View Related
Apr 17, 2007
I have a workbook with four worksheets. Sheet1 is the master. On sheet one there is information in a 10x10 table. The first column of the table contains a status of "No, Maybe, Yes." A record will start with a status of No and move to Maybe and then yes. What I want to do is be able to dynamically fill sheet2-sheet4 with information from the master. If the status is "Yes" move that row to sheet2. If the status is "no" move that row to sheet 3. Etc. Further complication that is depending on status, I want specific columns from the master, not necessarily all of them.
View 2 Replies
View Related
Jul 6, 2007
I have a master spreadsheet containing 4 relevant fields, 'Manufacturer', 'Product', 'Version' and 'Type'. This contains all possible variations of 'manufacturer', 'product' and 'version' that can occur in the organisation.
The type field shows how the particular item is going to be processed, either 'automated', 'manual' or 'non'
This is a computer generated spreadsheet, apart from the 'Type' field which we've entered for each one individually, as are the user spreadsheets which dont yet have the 'type' field.
This is a large list of around 7000 items
I then have a multiple spreadsheets (one for each user, totaling around 1200) that has a list of a couple of hundred items that are relevant to the user which contains 'manufacturer', 'product' and 'version'.
i need to sort these out quickly by comparing the sheet to the master spreadsheet so where 'manufacturer', 'product' and 'version' match up with the masters record it automatically removes the the 'non' type of item from the user sheet and placing either 'automated' or 'manual' in a new 'type' filed where appropriate
View 3 Replies
View Related
Mar 31, 2009
--------------------------------------------------------------------------------
Ok i have a formula that i use to convert bond prices, which are in 32nds to numbers that excel can understand. I use the formula:
=LEFT(F7,FIND("-",F7)-1)+SUBSTITUTE(RIGHT(F7,LEN(F7)-FIND("-",F7)),"+","")/IF(RIGHT(RIGHT(F7,LEN(F7)-FIND("-",F7)),1)="+",64,32)
This allows me to type 101-16 in and excel recognizes this as 101.5
My problem is that my data I am copying into the sheet is often in 1/8ths. So the price will come in as 101-272, which means 101-27 and 2/8 (or 1/4).
I admittedly dont understand this formula and just use. Can someone help me tweak it to recognize the third digit?
View 11 Replies
View Related
Feb 8, 2012
At work, I have a workbook with multiple tabs that contain lists. Each tab has a corresponding Pivot Table.
There is a business requirement that a user can specify a name, which filters the data. For the sake of simplicity use this for an example
Column Headers: First_Name ; Last_Name; Age
Row 1: Johnny; Bravo; 29
Row 2: Shane; Falco; 34
Row 3; Bobby; Shane; 15
The user specifies "Shane" as the filter in another pre-determined Cell (D1). Using advanced criteria, I need to find all rows that have Shane in either First_Name or Last_Name. The only way I know how to do that is inserting two rows and adding criteria:
First_Name ; Last_Name; Age
=D1; ;
;=D1;
Johnny; Bravo; 29
Shane; Falco; 34
Bobby; Shane; 15
With Criteria Range = "A1:B3"
This is problematic because my Pivot tables now include 5 rows of data.
View 3 Replies
View Related
Nov 17, 2009
Convert the first letter of a string to a capital without altering the rest of the strings format.
example: the activecell contains the string a1st (lowercase a, superscript 1st)
how can i achieve this in VBA?
Additionally, is it also possible to convert all of a string to capitals except the superscript characters
View 9 Replies
View Related
Dec 23, 2009
I have a Formula question which I can't seem to figure out. I want to set a cell so that when two other cells are above 80 then the cell is green.
If one of the two cells is bellow 80, the cell turns to yellow and if both are bellow 80 then the cell is yellow.
View 2 Replies
View Related
Feb 5, 2009
Unzip Code - Works without Variables, Breaks with Variables.... This has been driving me bananas...
I have the
View 2 Replies
View Related
Jan 9, 2009
I was wondering if it's possible to unhide a row directly below one that is visible?
I am creating a template for users that allows them to choose which lines (rows) they would like to use. They then hit a button to hide all the other lines they don't wish to use.
For each row that is visible I then need the row directly below it to become visible so that the user can enter associated information.
I'm stumped on how to do it. I have the user entering "a" in column A for any row they wish to keep - but I'm not sure how to incorporate this into unhiding the row below (or if I'm on the wrong track with my thinking).
View 5 Replies
View Related
Aug 7, 2012
How I can control many loops directly after each other. For example I have this script:
If (Cells(x, column) > 35 And Cells(r, column) < 25 Then
If (cells(x, 75) = "GotU") Then
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Else
If (cells(x, 85) = "GotYah") Then
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Else
If (cells(x, 95) = "GotYou") Then
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
End if
Is this script correct if I want the loops to check all data that I write (for ex. GotYou, GotYah etc.) or do I need to end every if before next if? I want that the loops makes all 3 controls.
View 9 Replies
View Related
May 16, 2014
I've been working with this script to import and paste a webpage to a worksheet. Once the webpage is on a worksheet I can pull it into VBA easily enough but I was wondering if there's a way to "paste" the webpage directly into an array in VBA and skip the paste to worksheet step?
Code:
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Navigate theURL
IE.Visible = False
End With
[Code]....
View 4 Replies
View Related
Mar 12, 2008
I have a validation box that has 371 names it using the full range of the alphabet.
Is there away within the validation box that instead of using the scroll bar that you can insert a letter or letters to take you to the name directly?
View 9 Replies
View Related
Jun 15, 2006
I have developed an extensive program running on excell but with the user only seeing userforms. I would now like to build in a "print screen" button, but have no idea how to do this.
What it needs to do is capture the userform and all its entries (as it is displayed on the screen) and send this to the printer to be printed as a picture.
I am assuming that there must be code available so that when ever the user clicks this button, the standard windows (or excell) print screen appears from which he will be able to choose the printer etc.
View 3 Replies
View Related
Jul 11, 2006
I have found some code that allows me to email directly from within a workbook, but the example only contains one addressee, I wish to send to 3 or 4 different addresses, these addresses would remain constant once entered. How do I alter the code?
Sub sendactiveworkbook()
ActiveWorkbook.SendMail _
Recipients:="type-in-email-address", _
Subject:="New Quote Raised - Test Transmission " & Format( Date, "dd/mmm/yy")
End Sub
View 3 Replies
View Related
Jun 28, 2014
I would like to simply reference this range of cells and change one formatting attribute.
VB: Sheets("flaggedSite report").Range(Cells(RowV, 2), Cells(RowV, 6)).WrapText = True
I get a runtime error 1004 with this???
VB:
With Sheets("FlaggedSite Report").Range(Cells(RowV + 1, 2), Cells(RowV + 1, 5))
'.Range(Cells(RowV, 2), Cells(RowV, 6)).WrapText = True
.WrapText = True
End With
This one runs but gives me unpredicted results. This one I think changes the format on my original sheet vs FlaggedSite Report.
VB:
With Worksheets("FlaggedSite Report")
With Range(Cells(RowV + 1, 2), Cells(RowV + 1, 5))
.WrapText = True
End With
End With
All I want to do is with as small a code as possible make a change to an inactive sheet of my choosing to the wrap format of a range of cells.
View 3 Replies
View Related
Aug 10, 2009
Is there any way to refer to a cell that is directly to the left of the current cell?
I need to create a Comma-Separated Value file with the Excel formula in the CSV file. Because of this, I do not know the current cell location, but want to do something like =(Cell directly to the left of me) + (Cell two cells to the left of me)
View 2 Replies
View Related
Jul 2, 2013
I have an excel file with about 200 images! This increases the filesize too much. So, I want to (if possible) have all the 200 images in different files, but still show all the pictures directly in Excel like before, without having the directly imported into excel. So, easy explained: I want to show a picture directly in excel that is in another file without having the picture increasing the filesize as before! How can i do this??
View 6 Replies
View Related