Code To Extract 4 Right Chars And Paste In Another Column
Oct 27, 2009
I am having problems with a macro I am writing and I need some guidance on where I am going wrong (I am still a noob at VBA).
I have pasted the code below (not the most efficient use of code I know).
I have a list of departments and codes from the Intranet at Work. Now this contains a Department Code, Department Description and within the Description is a number in brackets showing how high up the organisation hierarchy they are....
The External column contains data provided by an external vendor. The Internal column contains data compiled internally. The data in the Internal column will always contain data duplicate to the External column, but will also contain unique data not present in the External column. I would normally cut out the data contained in Internal column that is not duplicated in the External column, and paste it into the Differences column, and move the remaining cells in the Internal column up. The result would be the External column data and Internal column data would align by row, and the data unique to the Internal column is segregated to the Differences column, like so:
While not a difficult task for 8 rows of data, the actual daily report contains over 1000 rows, on average. I would like to set up a template workbook, where I can simply open the template workbook, paste the data into both the External and Internal columns, then have the values that are unique to the Internal column extracted from the Internal column and inserted into the Differences column.
The end product would be used daily, with differing amounts of data (from 100 rows to 10,000 rows).
The data exists in a spreadsheet that has Data from Column B2:CQ18, but it needs to be dynamic and update anytime someone clicks the button (the button is fine and works with all the other Macros)
Here is the code I have so far.
Code: Dim LastCol As Range Dim NextColPaste As Range With Worksheets("Run Hours") Set LastCol = Range("M3:M18").End(xlToRight) Set NextColPaste = LastCol.Offset(, 1) LastCol.Select End With
That Code will Select the data in row 3 only and not the whole range of 3:18
I have tried Range (LastColData & "3:18").Select and that selects everything on the whole page from row 18 down.
I have done a lot of searching and for some reason this dynamic selection and pasting of data is escaping me this morning
I have a spreadsheet and I was wondering if there is a way to copy from a specific range in say A1:A5 in Sheet1 and paste into Sheet2 where the column matches cell A1 in Sheet1.
I am trying to do this in VBA and I was wondering if there is a way to do this.
I have previously used the following code to successfully pull out IE webpage source code for string manipulation.
Its a crude example to demonstrate the principle:
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Public IE As Object Sub Sample() Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True
[Code] ......
However when I substitute in a Google websites address into the IE.Navigate command, the code runs to the "Source_Code = IE.document ...." line then flags up a Microsoft Visual Basic error. "Run-time error '438': Object doesn't support this property or method"
The webpage that I am trying to access is a confidential company site, so you won't be able to access it yourself, but starts with [URL] ......
The one thing that I have noticed about this website is the Privacy Report icon in the lower right status window (Picture of an eye with a restricted symbol in front). I don't know whether this is the cause of my problem, or purely an incidental observation.
Is there something peculiar with Google sites that means that the source code cannot be extracted in general, or is this an issue specific to my site ? Does the Privacy Report icon have any relevance, and if so how do I switch that off ?
The Formula bar shows: ="01/01/2009" The cell presents: 01/01/2009
I need to remove the equation sign as well the two inverted-commas.
I am familiar with the "Text to Column" feature, the use of SUBSTITUTE Function, a short macro and also the Find&Replace is also a good idea but, as far as I understand, it must be run Twice(!)
I am looking for a way to use Find&Replace in "One! shot" - meaning, to put the TWO different(!) characters [ the '=' and the " ] in the 'find what' window, leaving the 'replace with' window empty.
I know that something similar to that can be done in a "Word" document - but can it be accomplished in Excel?
I believe I should use the INSTR function, but I simply dont understand its use very well. I have a string in a cell, "MEAS/SPHERE,F(QUA_1),5", the characters I need start at the "(" and end at the closing ")", ref: (QUA_1). The start and end will always be the same, the length of characters and the spelling of characters be anything. Thus, QUA_1 can be CAL_1, CAL_2, SOMEOTHERTEXT_1 or 187bgo_199, etc, always enclosed in "( )". I wish to place the characters and the closing "( )" into a variable as a string.
This one has two sets of quotes, with the information from the noted post I can retrieve the string "S5a09b-90", now that I have a double set of brackets "( )" how do I get the value for the second set of brackets, "CAL_15"?
In the quoted string, CALIB/SENS,S, is constant. The first set of brackets are constant (string length is not), the second set of brackets are constant (string length is not).
Is this possible using code: Copy Cell A1 and Paste in first empty Cell down Column D. This would be connected to a command button. Both Cell A1 and Column D are on the same spreadsheet.
I made in a macros this formula :LEFT(RC[-1],(LEN(RC[-1])-2)) is removing from left side an index , like in this example ' 9117 - 570-65CE49D-B4-7 to obtain 9117 - 570-65CE49D-B4
so here is my code,
is with an userform, but it gaves me an error, that my procedure is invalid
I need to some spaces to the end of a string to make it up to 36 chars.
The original string can vary in size based on the courier name. i.e. : business direct invoice 40617 = 29 chars i.e. : TNT post invoice 4061755 = 24 chars
Can someone point me in the right direction to be able to concat' some spaces on the end to make it up to 36 chars.
I want to remove varying amounts of periods that appear at the end of my strings. For instance, ABCEDFGH......., DEFGH.., FG.... etc. Do I have to test each char to see if it's a period, and then use that count of chars to LEFT out the string that I want? Or is there an easier, quicker way to do this?
I'm looking for a formula which returns the longest consecutive series of occurrences of 2 chars in a text string.
In the case I'm trying to count the longest consecutive number of nine-spares (9/) in a bowling game.
For example:
|7/|X|9/|9/|9-|9/|9/|9/|9/|X8/|longest series of 9/ would be 4. |9/|9-|9/|9/|7/|9-|(8)/|X|7/|9-|longest series of 9/ would be 2. |9/|(8)1|X|X|72|63|7/|8/|8/|9/9|longest series of 9/ would be 1.
I have a file of names that has some undisplayable characters. I am trying to match against a different file. It works if I overtype the "blank" fields with a space. How can remove these trailing problem characters whatever they are? I tried CLEAN and TRIM and the mystery characters are still there.
I'm using excel 2003 and I have have a dynamic string of data separated by 19 commas ",". I think 19 (the # of commas) is one of the few fix numbers...
What I'd like to do is from Right2Left return the 5 characters immediately to the right of (before) the 11th "," comma (i.e. 22.59 for the 1st string on Excel Cell A2) OR from the Left2Right return the 5 characters immediately after the 9th comma "," comma, which is also 22.59
Example of some of the strings I've been trying to work with...the list is much longer...but for example sake I've limited to 4...
I have a mixed list of materials in column 'A'. I have two macro/filters to extract (copy/paste)... one for those ending in "[G]", and one for all others (those not ending in"[G]"), to columns 'B' & 'C' respectively. The code looks like this;
Am working on a procedure to open all files in a folder and copy some data from the files into another workbook (master). I have this piece of the code. However, I also need to get the filename (from which data was copied) and paste this into an adjacent cell in the master (so I know which file each data point came from).
I get one report.xls workbook by FTP. This book contain date and time in cell A14 in sheet1. e.g. 30-04-2006 19:38:00
I need to have macro to extract only time and paste it to cell A56 in same sheet. How can I do that. The date format is 30-04-2006 19:38:00 and it may be 05/05/2006 7:15 am. Or it could be any type of date format. Please send me how can I work with different date and time format to extract the only time and paste to other cell.
I have a workbook with 2x Worksheets "Data" and "Check"
On the worksheet Data I have a series of Values
Column A = Names Column B = Cost Column C = Dpt
I want to create a piece of VB code to extract from the list on the "Data" worksheet, only those lines where, there are 3x occurrences for a Name where Cost = zero
Can anybody post me some links to automating data extraction from Websites using VBA and IE. Not something I have ever bothered with before. Basically interested in using the controls and pulling tables.
I am trying to extract the data values from the references Bundesbank page and get them into a worksheet so I can manipulate from there. What I have is below.
This is column a and b. Looking at b I am looking for a formula that will pull the first capital letter out of each word like ACR to create color codes.