Determine Sheet Names Starting With X Specific Characters
Jun 12, 2008
I have a worksheet that will have tabs added as time goes by and a macro within the workbook currently selects all of the sheets and copies and pastes formulas within all of the sheets simultaneously. Right now, if a tab is added, the macro needs to be updated to select that specific tab name as well.
I would like to simply have the macro select all of the sheets starting with "IL" until the sheet before "reference", or all sheets except the first 3 and the last 2 if that is easier. Any ideas? And thank you for your help, you people really amaze me sometimes!
View 9 Replies
ADVERTISEMENT
Jun 19, 2013
I use the following code to copy entire rows from one sheet to another and this is pretty standard.
VB : rng.EntireRow.Copy Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
Assuming that Sheet2 is blank, this of course copies the rows to Sheet2 starting at Cell A2 and down column A. I would like to modify the code so that I can specify at which row the copy should start. For example, I might want to start the copy at A1 instead of A2, or at A10 instead of A2.
View 5 Replies
View Related
Jan 13, 2014
I have a long customer listing, names 5 to 36 characters and several with their location in the name as well as a few common duplicate names. I am trying to produce sheet where the customers name once selected opens in the customers spreadsheet and data can be added/amended for sales etc.The lists are not in alphabetical order as when created a customer number is automatically allocated. My aim is just to type in the first letter of the name and the dropdown appears the customer is selected and their card appears. I have tried data validation, lookup, vlookup, Dropdown and Match/find. they only return the first record found and no sign of any others. Find returned all instances of the letter appearing in every name.
View 9 Replies
View Related
Jun 11, 2012
I'm scanning data into a spreadsheet using a barcode scanner, but I want the starting character and trailing characters to be removed after I hit enter.
For example...let's say I'm scanning the following text in cell A1:
=W05281212345600
When I hit enter (or the barcode scanner does auto-enter), I want cell A1 to read:
W052812123456
I will always want the "=" and the last two zeros removed from the 16 character number, leaving the 13-character number in its place.
I tried using Excel's various truncate functions (LEFT,RIGHT,MID, etc.), but that only places the corrected text in another cell. That would be fine if I could copy that truncated text back over the original text...but that created a loop problem.
View 1 Replies
View Related
May 21, 2008
I am trying to enter only the named ranges in the active worksheet into an Array.
The amount of named ranges can be from 4 to 7 per sheet.
I'm self taught at VB (This posts on this forum have taught me - thank you!) and have got the below code working on a Workbook - but not on a worksheet level.
ActiveSheet.Names.Count returns nothing, changing to ThisWorkBook.Names.Count returns the sum of all .Names in the workbook.
Sub aTest()
Dim sArray() As String
Dim sJoin As String
Dim y As Long
x = 1
y = ActiveSheet.Names.Count
z = ActiveSheet.Name
View 3 Replies
View Related
Sep 13, 2010
I need a macro that will look for a specific text string in the tab names of the workbook and replace it with a new specified text string (leaving the rest of the existing tab names). In other words, a simple find/replace but applied to all tab names in the workbook rather than cells. Ideally, I'd like it to pop up something and ask for the text to find and the text to replace it with, so I don't have to edit the macro itself each time I want to use it, but editing the macro each time is fine. Either way will be wonderful.
View 9 Replies
View Related
Dec 4, 2008
I have this script (below, Krishnakumar orignally provided this script).
I'm trying to edit it to add cell values from cells C16 and E16 along with the worksheet name it displays in listbox2. So lets say worksheet "rollover" is the sheet being displayed in the listbox2.
I would like for it to look something like this:
rollover TT:'data from cell C16' TA:'data from cell E16'
Public FilePath As String
Public dic As Object
Public oWB As String
Public oWS As String
Public aWS As Worksheet
Private Sub CommandButton1_Click()
Dim i As Long, wb As Workbook, n As Long
With Me.ListBox2
For i = 0 To .ListCount - 1
If .Selected(i) = True Then
oWS = .list(i)
Set wb = Workbooks.Open(FilePath & oWB, UpdateLinks:=0)
wb.Sheets(oWS).Activate
Exit For
End If
Next
End With
End Sub
View 7 Replies
View Related
Sep 4, 2010
Let's say I have a long macro and I want to test some code a ways down in the macro, but I don't want to have to run through all the code to get there, because I already have my Excel spreadsheet set up at the point I need to check and I just want to start checking the code a ways into the procedure.
Short of commenting out all the code above where I want to start, is there another easier way to do this?
View 8 Replies
View Related
Jun 20, 2008
I'm trying to write a macro that will find a value beginning "ber" and paste it across to a different column. I have had a go at it but I keep getting the offset flagged up.
It needs to move 15 columns across and 7 rows down if that is of any importance.
View 9 Replies
View Related
Feb 22, 2008
I looked at a couple pages of Ozgrid solutions for people that were having word wrap issues and decided my issue wasnt related to any of them - my cells are not merged and they are not exceeding 1024 characters. I have a sales sheet with column headings as the name of the product, many of which have long names (but all less than 100 characters). For example, one cell value is "Flow Meters And Regulators 2007" and another is "Sphygmomanometers 2007".
My column width pre-format is 8.43 and after format is 7.86
The only code I use to adjust the row and column size is
With Rows("1:2")
.WrapText = True
.AutoFit
End With
Columns.AutoFit
As you can imagine "Sphygmomanometers" breaks into two lines in the short confines of 7.86 width. How can i get the column autofit to adjust to the full word?
View 4 Replies
View Related
Mar 7, 2008
Using VBA, how can I determine if a cell contains only white spaces and NO valid characters?
View 2 Replies
View Related
Jun 2, 2014
I have a spreadsheet where I track resources needed on a project. Each resource that is selected in the resource column has a corresponding % avg and an average number of months where the resource is used. % Avg and # of Months are found in a different worksheet.
What I am looking to do is, for example: if resource A will be on the project starting in May 2015 and assigned at 30% for 7 months, I want to populate 30% starting in the colunm labeled May 2015 and copy the 30% so that a total of 7 months are populated. Also, if any of the values change (i.e: the Resource Name or the Start Month) I want to erase all the percentages that were entered in the row. How can I achieve that with a VBA code? I have formulas that retrieve the # of Months and the % Avg already.
These are the columns that I have in my spreadsheet:
Resource NameStart MonthJan-15Feb-15Mar-15Apr-15May-15Jun-15Jul-15Aug-15Sep-15
View 2 Replies
View Related
Feb 3, 2014
I need to add something to the code below to have my first row of data entered into cell "Q8". As it is now the data is starting on row Q9 instead of Q8, but the rest of it is filling in correctly.
[Code] .....
View 1 Replies
View Related
Dec 10, 2007
Currently I am using the Kickbutt VBA Find Function of Aaron, but I would like to have something that works more efficiently. What I currently do is (assuming all possible values for Column J are A - F):
Find_Range("A", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("B", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("C", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("D", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("E", Columns("J"), MatchCase:=True).EntireRow.Delete
although I just want some code that says: delete all rows except those that have "F" as content in Column J. I already tried something like:
Range("1:65536").Select
For Each cl In Range("J:J")
If cl.Text = "A" Or cl.Text = "B" Or cl.Text = "C" Or cl.Text = "D" Or cl.Text = "E" Then
Rows(cl.Row).Delete
End If
Next
but it also takes much to long. The major problem I think, is that the number of records is variable so I search the entire worksheet...
View 5 Replies
View Related
Jan 22, 2010
I have 1500+customer names in column C7 of table. I'm looking for a SUMPRODUCT formula that achieves the following 2 logical goals. First, it needs to determine the number of unique names in column C7. It can't just count the rows because many customers appear multiple times in the range. So, I have been using the following formula and it works great:
=SUMPRODUCT(
((Table[C7]<>"")/COUNTIF(Table[C7],Table[C7]&"")))
Second, I'd like the formula to tell me how many of the unique names in C7 correspond to public companies. Column C8 of my table indicates whether or not a company is public ("Yes") or private ("No"). So, I've been using the following formula and it seems to deliver the right result:
=SUMPRODUCT(
((Table[C7]<>"")/COUNTIF(Table[C7],Table[C7]&""))
*
(COUNTIFS(Table[C7],Table[C7]&"",Table[C8],"Yes")>=1))
But the added COUNTIFS statement seems very unwieldy and indirect to me. Why do I have to examine every instance of a particular company's name when the answer could be determined by looking at any instance of the name -- after all, each company in C7 is either public or private, and has the same corresponding value in C8 (whether "Yes" or "No") everywhere that its name appears in C7!
So that's my first question: is there a clearer, more efficient way to achieve the same result? My second question has to do with toggling the public company test.
What if I create a special cell, say A1, that will always contain either the word "On" or "Off"........
View 4 Replies
View Related
May 13, 2007
I have a worksheet that contains active rows and hidden, inactive rows. On occasion, I would like to unhide an inactive row. I intend to do this by running a macro which will generate an input box to enter the file number of the row in question. I can restore the row, but what I am unable to find a solution for is converting the file number to the row number to be restored. The file numbers reside in column A, so if I input file number 2300, I need the macro to look through column A, find the cell that contains the value 2300, and return (as a string?) the row number that contains that value. From this I can have that row returned to visible status.
View 9 Replies
View Related
Dec 23, 2008
I have a range ie C2:D400.
The word "ball" appears many times in this range. How do I determine the last row that "ball" appears in?
View 9 Replies
View Related
Mar 2, 2009
I am using the INDIRECT function to get data from sheets with different names, with the format INDIRECT(SheetName&"!$A$1"), with SheetName defined as the contents of a particular cell which contains the name of the sheet. This works fine with the exception of sheets which have names starting with C01V. Is there something special about these names? If I change the 0 to O or the C to A, B or D, there is no problem. Sheet names C0, C01 also don't have any issues.
View 7 Replies
View Related
Jun 18, 2008
Basically, I want a formula that searches for more than one word anywhere within a cell, and if the cell contains any of those words somewhere in it then I want to display a value, but if the words aren't there, then stay blank.
For example, my cell could say: "Magenta, Rose, Lime, Lavendar". I want to search this cell for any of the these words: "Lime", "Forest" or "Teal". If any of these appear, I then want the cell with this formula to say "Green".
I know the formula to search for only one word /phrase in a cell, I use: =(IF(ISNUMBER(SEARCH("yellow",A1)),"colour","-")), (i.e. if the word "yellow" appears anywhere in cell A1, then this cell will show the word "colour", if not then a "-".) I tried adding an 'OR' function in this to search multiple words but it didn't seem to work.
View 2 Replies
View Related
Apr 9, 2008
See attached spreadsheet. I have a set of Jobs with a set of end dates. A meeting date should be held after the end of each job. I need a formula or macro to determine when the meeting date will be held? The criteria to determine the meeting date is found in rows 12-18. The end dates are set on different days of the weeks and different weeks of the month depending on the region that the job is located in. The meeting dates will be input in colums d, f, h & j.
View 7 Replies
View Related
May 7, 2012
Can I create data validation list of the names created in the name box or of the sheet tab names?
View 5 Replies
View Related
Oct 15, 2013
Code:
Sheets(Array("Sheet 1", "Sheet 2")).Visible = False
How do I convert the above to using Sheet Codes Names, Sheet1 and Sheet2?
Want to ensure my code will work if the user changes the sheet name.
View 2 Replies
View Related
Jun 18, 2013
I am currently using cell references to create a depedendent list with data validation. How to make cell references show up with some invalid characters?
For example, one of my cell references is Youngs_Market_Company. However, when pulling up the cell, I want it to be displayed as Young's Market Company.
View 2 Replies
View Related
Mar 20, 2008
I am aware that special characters such as -,(,),[,] are not permitted in named ranges (for lists), but is there a workaround for this? I have a lot of dependent lists that need to access names that contain either a - or () or both. I could simply remove the -'s or ()'s using find/replace, but they are required, as they're part of the name. I am aware of this method http://www.contextures.com/xlDataVal02.html#Illegal but I have a lot of dependent lists across a sheet, and a VLOOKUP isn't going to work. If there isn't a workaround, are there any allowed characters I could use to replace the -'s and ()'s?
View 3 Replies
View Related
Apr 29, 2008
I am attempting an If Or formula and keep retuning a #Value error, I can't for the life of me figure out why.
This is the formula that I have written.
=IF(OR(H44,H45,H46,H47,H48)="Other:","True","False")
Cells H44,I44,J44 have been merged into one cell (H44), and the same for 45,46,47,and 48 - Could this affect the Formula?
View 4 Replies
View Related
Jan 16, 2007
I need to create a sheet that will take payments away from a starting balance. The catch is that I don't know the starting balance. The interest is compounded annually at 3% and each withdrawl is different. My sheet needs to show the interest earned in each year and the account balance like a running sheet, after lets say 5 years there needs to be no money left.
View 2 Replies
View Related
May 1, 2008
Two part question:
1) I'm relatively new to arrays, but what I need to do is generate a list of file names and the sheets within each one. I would like to use an array for this, but since I don't have much experience.... well....that's why I'm here. Can someone point me in the right direction?
2) And the second part of this.... I was planning on using the FileSystemObject to determine the files in a selected folder and loop through that list of files, opening each one and harvesting the required info (file name and all sheet names). Should I use the FSO or is there something built into Excel that might be better (and also limit the number of dependencies for this little "project" of mine).
View 9 Replies
View Related
Feb 25, 2011
Is it possible to produce a list on a new worksheet of all sheet names and their their internal names within a workbook?
If so I would like the tabbed name's to begin in say A2 with the corresponding internal name in B2.
View 3 Replies
View Related
Feb 14, 2012
How can I delete characters unallowed in file names in cell text all in one go instead of below long macro. (i.e. can you minimize the below vba)
These characters that I wanna delete
"/", "", ":", "*", "?", "< ", ">", "|"
Code:
Range("A1").Select
Selection.Replace What:="""", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
[Code].....
View 6 Replies
View Related
Feb 11, 2010
I'm documenting the steps of a process with each step accounting for a specific amount of business days. How do I determine the specific business day based on the number of days it takes to complete a process? For example: Start date then 45 business days from that date the next step begins...then 3 business days from that date the following step begins and so on.
View 5 Replies
View Related