Determine Which Strings Are New And Copy Them To WS
Jun 16, 2006
I have a macro which makes two new WS (AU - UA and AU - LH), copies header row to both of them and then copy three letter airport codes which are in column A with appropriate prices to these new sheets. I need to modify code so if there will be in pricelist some new airport codes which are not in macro yet, that they would be copied to new WS (NEW CODES), so I will know which airports are new. I have attached example file, to make things clearer what kind of result I would like to get after running macro. Here is code of my macro:
Option Explicit
Sub UA_LH_OS_SK_VER_2()
'Turn off ScreenUpdating for faster runtime so screen won't flash while running
Application.ScreenUpdating = False
Dim CLL As Range, FaresWS As Worksheet
Set FaresWS = Sheets("FARES")
Worksheets.Add(After:=FaresWS).Name = "AU - LH"
Worksheets.Add(After:=FaresWS).Name = "AU - UA"
With FaresWS.Rows(1)
.Copy Sheets("AU - UA").Rows(1) ' Paste to worksheet AU - UA
.Copy Sheets("AU - LH").Rows(1) ' Paste to worksheet AU - LH
End With.....................
which i am using to map columns between spreadsheets. The basic numeric entries refer to columns to copy. But I want to make the routine smarter with the strings.
If array(x) = 12 (For example) Then Do something End If If left(array(x),1) = "=" Then Do something Else End If If array(x) Is String literal (e.g "xyz" Or "123") Then Do a third thing End If
i cant find a typeof or isstring kind of function. Isnumeric works ok for some values but quoted numbers (eg "123") return true (which isnt what i want). I have tried the left(string,1) = """ but excel seems to hide the quotes.
I am trying to find a function that will search for a particular name in a range and return ALL rows (or, preferably, specific cells in that row) which have that name in it, onto a new sheet.
eg. Sheet 1
Fred 45m $50 6/2 Joe 30m $35 5/28 Pete 60m $60 6/4 Fred 30m $30 6/6
If this range was on sheet 1, I would like to show on sheet 2 all times and dates for Fred in consecutive rows. ie the result on sheet 2 would be: Sheet 2
Fred 45m 6/2 Fred 45m 6/6
If selecting individual columns cannot be done, then the whole row would be fine.
I am trying to copy partial data from Column A into Columns B and C, then I want to delete Column A without affecting the results in Column B and C. Column A consists of a stock number in the format "1234-56-789-0000" (including the dashes) and is formatted as TEXT.
I'd like to paste the "1234" from Column A into Column B and the "56-789-0000" from Column A into Column C AND remove the dashes (-). I need to do this for the range (or number of rows) that is populated in Column A. This could be as many as 50,000+ rows of data. After this is done, I want to delete Column A. I tried using the LEFT and RIGHT formulas, but they are dependent on keeping Column A intact.
........... A .................. B .............. C ...... 1234-56-789-0000 ..... 1234 ..... 567890000
and then eventually like this:
. A ............. B ...... 1234 .... 567890000
On occasion, leading zeros in Column C have disappeared, and it's necessary it stay in a 9-digit format. There are 2 additional columns of data, but they shouldn't be affected by the above.
pulling out data in a column, lets say column K, that is between a 12 and 20. There are quite a few lines so I would like to be able to pull them out automatically. In addition, I would like for the macro to pull the entire row of data not just the specific cell value.
I require a row of details to be copied to another worksheet by typing in a unique ID using a macro so Sheet 1 is a data base of items (every item have a unique code like 1001, 1002 etc) and sheet 2 has a table, and next to the table is a cell, which i need to work like a search engine.
i need to be able to type the unique id in a cell, in sheet 2, then click an Add command Button. This button then finds the unique id in sheet 1, and copies all the items details in the same row, into sheet 2 in the table, then i require the search engine to be cleared for the next item to be added. (Assumed Experience:Below Average, I know few formulas and know very basic macros)
For example: I want to sort through a a bunch of textboxes and refer them to certain cells. I know I can have a string "TextBox" and then the looping number "nbr" and merge them into for instance TextBox1. But I can't figure out how to use this as a command. Like
Different formula in different cells give me some text as output, to format this. I would like to copy and paste in one cell, so that I can easily then register a macro on top to wrap the text in one big cell.
I'm trying to insert a set of strings, and for some reason its not going to the next open row, its just inserting them over the last record.
Code:
Private Sub Insert_Payment_Click()Dim Payment As String, PaymentAddress As String Worksheets("Payments").Select Payment = Range("E4") PaymentAddress = Range("B4") Worksheets("RentalDates").Select Worksheets("RentalDates").Range("I1").Select If Worksheets("RentalDates").Range("I1").Offset("1,0") "" Then Worksheets("RentalDates").Range("I1").End(xlDown).Select
I am trying to parse employee names into seperate string variables in order to display surname, first name and middle name in seperate fields on a form.
The format of the full name is "Surname, First Name, Middle Name (If any)
I have managed to deal with surname and firstname but I am stumped on middle name. Not all employees will have a middle name but for those who do, I need to parse it.
I'm getting this weird error which must because I've overlooked some simple thing about formatting (is it called formatting?) my variables.
See, what I think is wrong is that I'm comparing a string with a range and that can make 37 not equal to 37.
Because that is my problem; I have an If statement that compares 2 variables that I know should be the same but the If statement doesnt think so. So to my question; am I on the right track here and if so, how should I tell vba what is a string and what is a range and if I am on the wrong track here;
I am trying to compare two cells to see if its two values are the same. Some of the cells have a space in between numbers or a symbol like "-"
Ex.
one cell's value is 1213180IN
and the other cell's value is 1213180-IN
the program I have written marks these as different because of the "-" in the second cell....is there a way, maybe with a string function to overlook that "-"?
I've got above basic VBA knowledge and learning very quickly (largely due to great forums like this) I'm now creating a userform for the first time. I'm trying to create a New Supplier form and one of the fields is going to be for Supplier ID where it takes the first 6 letters of the Supplier name (entered by the user) & tags on '001' at the end. I've managed to do this but I would like some code to search existing supplier ID's ( Column A on separate sheet) and check whether the ID created already exists and if it does add on '002' instead of '001'.
SO for example..
If user creates a supplier called Microsoft the supplier ID will be Micros001 - this I can do, but if Micros001 already exists then it will generate an ID Micros002, Micros003 and so on...
I have a problem, I have a workbook that is used for importing products on to my website but for the description field it keeps adding the double quotes to the text. this text is HTML code. when I import the products to my website, these quotes show up at the beginning and end of the description. You can't see the quotes in excel but if you copy and paste the cells data in to a text editor you will see the quotes.
My question is how can I remove these? I have removed them in the text editor but as soon as the data goes back in to excel the quotes are automatically inserted again...
I have a long list of locations in an excel spreadsheet, stating either the country (eg India) or for US locations the state (in a two letter format, eg NY). I need to change all the state location to say "USA". How can I do this, without doing 50 find and replaces? Can I do something based around the fact all the USA locations are two letters, whereas all the others are longer?
I don't know what's wrong with this it's not working..
=COUNTIF(SEARCH("radio",A2:A20),"")
i just want to count all the cells from a2 to a20 that has a word "radio" from that cells. Since a2 until a20 have different words like tv power, radio blaster (this should be consider because there's a radio word on it) and so on.
if i use only =COUNTIF(A2:A20,"radio") the word should be exact "radio" and it wont consider the word "radio blaster".
I have a column filled with names per row. I wanted to standardize it by using the following format.
The comma after the last name is always an indicator to me that it is the last name.
<First Name> <Middle Initial(if any)> <Last Name>
My actual records contains the following:
BIMBO EPPING - OK AHMAD SADICK - OK Salana, Laura R - need to be arranged to > Laura R Salana Cantos, Rhoda Grace J - need to be arranged to > Rhoda Grace J Cantos
I'd like to write a formula that check if a string (contained in another cell - say A1) includes at least one occurrence of one of a set of 5 sub strings. If the substring is included then it should return which one.
For istance, say that the cell A1 = " The colour is BLACK" then I'd like a formula in cell B1 that check if any of the following strings is included in A1 (RED, GREEN, BLUE, BLACK, ORANGE) and that tells me which one.
I need to get the count of a string from multiple columns. The problem is that string1 exists in column A and String2 can exist in one of eight columns. See the example below.
What I want to do is use two search criteria. I want to find the number of times I have Type=A and if the row has a case Beta. In the example above I should get an answer of 2. (From rows 3 and 9)
I tried countifs but I cant seem to get it working properly.
so it first sorts in alphabetical order using the string before the "-" i.e. CAM27 comes before CAM100, and then by the biggest 'secondary values' (the value after the "-") so that COM98-23 comes before COM98-21?
I have a workbook called Keyword that has two columns c,and d, of words.
The length of the columns can vary,because I add words to them.
I also have a workbook called testfile, and cell B1 has a word in it.
Testfile also has an .xla module that adds in when testfile is open.
I want to type a function called asset in cell C1 of Testfile,and have it compare each word in Keyword workbook to the word that's in cell B1 of testfile. If a match is found in column C of Keyword, the function returns the letter C. If match is found in col D of Keyword, it returns the letter D. If no match, function returns "no match".
I have both workbooks open and the vba code I stuck at the bottom of the .xla module as another function.
Here's my code so far.
Function asset(Description As Variant) As String 'arg. is the word in cell B1 in testfile
Dim LastRowOfC As Integer, LastRowOfD As Integer Dim i As Integer
I have a set of 4 columns with YES/NO statements in them. I need to find any YES strings, of three or more, within one column, uninterupted by a YES in another colum.
EXAMPLE: _____A ___B__C__D__E 1 1/1/2008 YES NO NO NO 2 1/2/2008 NO NO YES YES 3 1/3/2008 YES NO NO NO 4 1/4/2008 YES NO NO NO 5 1/5/2008 NO NO NO NO 6 1/6/2008 YES NO NO NO..................
I have 2 sheets of data. I am looking for a macro that will check if there are any strings that exists on Sheet1 but not on Sheet2 and if they do, paste them at the end of Sheet2. All of this data is in Columns A by the way.