Converted Into Vba Code
Apr 13, 2009
I would like to have a code (VBA) for the below formula so I do not have to protect my worksheet (column B).
=IF(D15="","",INDEX(Sheet4!$C$14:Sheet4!$C$3000,MATCH(D15,Sheet4!$A$14:Sheet4!$A$3000,0)))
The above formula ends down until B13000. I feel the slowliness of Excel. I have seen something like this using the code (VBA) and it was not so slow compare with the formula created on the cell.
View 9 Replies
ADVERTISEMENT
Sep 25, 2008
I've got a rather large set of data consisting of many sheets of data. I need to gather some of this data in a summary for to make it presentable. (Common goal) Currently the summary page works on a series of sumproduct commands that reference other sheets and take a great length of time to compute. I'd like to change this into a VBA code to speed up the process and eliminate all of the Sumproduct referencing. I know that in VBA you have to use the execute command to sumproduct, but i continue to get errors that i cannot resolve.
This is a sample of on of the sumproduct formulas that works (though slow) in the sheet:
=-SUMPRODUCT((('June Data'!A2:A65535="18020")*'June Data'!I2:I65535)+(('June Data'!A2:A65535="18030")*(LEFT('June Data'!E2:E65535,2)="AF")*'June Data'!I2:I65535))
The Raw data comes in columns A thru L. I need to sum the values from column I when column A = "18020" or when column A = "18030" and the left to letters of column E are "AF".
When I input the sumproduct into VBA using the execute command I get a compile error, it says it expects a list seperator at the "18030" and doesn't like the quotes. When I remove the quotes or put single quotes the result i get is a NAME# in the cell. Any help would be appreciated. This is a clip of the VBA code. Also, anything that is faster than execute would be much appreciated. I suspect that even in VBA having to run 50 of these sums will take some time.
Range("q4").Select
Selection = Evaluate("=-SUMPRODUCT(('June Data'!A2:A65535="18030")*(LEFT('June Data'!E2:E65535,2)="AF")*'June Data'!I2:I65535)")
View 9 Replies
View Related
Nov 3, 2008
I work for a company that exports data from a website into Excel.
So here's my problem:
The data is usually Part Numbers using numbers and letters. When a Part Number is, for example, 248E12 we have this reaccurring issue. Importing it into Excel automatically converts it to scientific notation (ie. 248E+12 or 2.48E+14 to be exact). "Format Cell" doesn't convert it back because it was auto-converted when "exported". I need a way of fixing this problem without going line by line and doing the math to convert it myself.
I don't have time for that. Some of my files have thousands of lines.
View 14 Replies
View Related
Feb 29, 2012
I have converted a column of dates to days using format & dddd. However I'd now like to count how many mondays, tuesdays, etc are contained in this list, however as the data is still a date I cannot seem to do this.
View 6 Replies
View Related
Aug 13, 2009
I currently have formulas in a column setup (equations are not actual)...
Cell B1: =IF(A2>A3,"Y","")
Cell C1: =IF(B2>B3,''Y",''")
Cell D1: =IF(C2>C3,"Y","")
....
I want to switch these to one long row from one long column so that they span from Cell A1, A2, etc.
When I special paste or straight paste it obviously alters the formulas because I am also unable to cell lock the current formulas.
I am wondering if there is an easy way to convert my formulas, currently along a column, to a row? Or if there is also a way to cell lock a large amount of cells at once?
View 9 Replies
View Related
Jul 6, 2006
When I open a new excel workbook and enter a number in any cell it formats it as though I am entering a percentage. So when I enter 100, the cell value becomes 1. How do i change this? I have tried formatting the cells and no change....
View 3 Replies
View Related
Nov 28, 2013
I have adapted the use of StephenR's solution to a problem similar to that in the thread linked below. However I want to load the data directly into a new sheet instead of loading it into line 27 of the current sheet. This is the code I am working with, I think I need to change r2 somehow, not sure what to do exactly though.
[URL]
VB:
Sub KonverterFraMatrixTilListe()
Dim rng As Range, c As Long, r As Long, r2 As Long
r2 = 27
[Code]....
Another thing that I really want is for it to run not only for rows 4-8, but for rows 4-last row as defined by the A column.
View 7 Replies
View Related
Apr 24, 2014
I have a worksheet with a series of data in rows. Every 40th row is a sum of the previous forty rows.
I have a second worksheet that in a series of columns uses the 40th row sums from the other sheet. So column 1 uses row 40, column 2 uses row 80 data, etc.
Every time I update this, I create the new column using a copy and insert copied cells and then have to go to each field on the new column that uses this other worksheet to correctly update the formula for the new row. As when I do it this way, if Column 1 cell a1 formula said "worksheet2!A40, then the new column 2 cell b1 says "worksheet2!B40, where I want to make it be worksheet2!A80. I have tried highlighting a series of these corrected columns and dragging the formula over but still get a change in columns vs row from the other sheet.
I am looking to see if there is a way to do something like (in layman's expression):
(first column) worksheet 1, cell a1 = worksheet 2 cell A40
(second column) worksheet 1, cell b1 = worksheet 2 Cell A80
(third column) worksheet 1, cell c1 = worksheet 2 Cell (A80+40)
etc....
View 3 Replies
View Related
Apr 3, 2008
If I create a Workbook in Excel 2003 with Pivot Tables when I open it in 2007 the Pivot Table are no longer there. It look like the Pivot has been converted to Data only. Are there any ways of correcting this?
View 3 Replies
View Related
Mar 9, 2009
I have attached an example sheet to help visually explain what I am going to try and articulate. Cell A2 and B2's values result in cell E2, Cell C2 and D2's values result in cell F2. The same is true for row 3.
So what I would like to do is, based on the predetermined ranges of the Height+Chest Columns, auto complete column E, and Columns C+D, auto complete column F. My problem is that I cannot simply cell A + B = E, because the maximum range of one layers the minumum range of another. An example would be Maximum of A+B is 101 to result in SXS in Columm C, but the minmum A+B to get a SS in column C would be 97. So what I need is, for another specific example:....
If cell A2 is between 57 and 65, and cell B2 is between 31 and 36, then Cell C2 must be SXS. If Cell A2 is between 66 and 68, and Cell B2 is between 31 and 36, then Cell C2 must be SS.
View 5 Replies
View Related
Apr 18, 2014
I want some vbs code on my 'Copy All' button in Email Data sheet which will do my work. Its a bit lengthy but who knows the concept will find it easy.
I have one sheets -
Sheet attached - Worksheet .xlsm
Workshet.xlsm [Data in 'Mod' sheet i)should convert from text to column and paste in 'Row Data' sheet ii) then transfer form Row Data sheet to 'Email Data' sheet 'Mobile Data' sheet and 'Other Data' sheet when Copy All button is clicked in Email Data sheet.
There should be some logic which will fetch appropriate date from 'Mod' sheet to the respective sheet . We can have some kind of logic like
If 'Register' found then take the value of register and workstation and paste in Email Data sheet.
All data below should be fetched from Row Data sheet which is blank now and will get the data when we click the Copy All button ,
1st Register Count:
Below Register Count (*) i.e. 16 If workstation count present copy to E15 in Email Data sheet in Table B
Below Register Count (*) i.e. 9 If register count present copy to E16 in Email Data sheet Table B
2nd Register Count:
Below Register Count (*) i.e. 8942 If workstation count present copy to C15 in Email Data sheet in Table B
Below Register Count (*) i.e. 2883 If register count present copy to C16 in Email Data sheet in Table B
3rd Register Count:
Below Register Count (*) i.e. 0 If workstation count present copy to E18 in Email Data sheet in Table B
Below Register Count (*) i.e. 1 If register count present copy to E19 in Email Data sheet in Table B
4th Register Count:
Below Register Count (*) i.e. 98 If workstation count present copy to C18 in Email Data sheet in Table B
Below Register Count (*) i.e. 999 If register count present copy to C19 in Email Data sheet in Table B
Substr:
B32:B44 will be pasted in C29:C41 in Email Data sheet in Table C
i.e. 10 to 22 values should match in corresponding 10 to 22 values in Email Data sheet , if not not any value then 0
B50:B62 will be pasted in B29:B41 in Email Data sheet in Table C
i.e. 10 to 22 values should match in corresponding 10 to 22 values in Email Data sheet , if not not any value then 0
View 1 Replies
View Related
Jan 8, 2013
I have a document that I downloaded some data from the Internet "Kronos" and within this data there is a column for date. This column is formatted as Date (01/08/13), but it only displays the date as Sun 1/01. It's missing the year, which it should be 01/01/12. I have tried to use TEXT function to convert it to month name and day name using TEXT(N4, "mmm") and Text(N4,"ddd"), but I still getting Sun 1/01. I have also tried to use Text to columns to split this date but, it does not work. Is there any other way I can convert this date into m/d/yy?
View 2 Replies
View Related
May 23, 2014
I have a some dates in a format which are not being converted into the normal date format. So i made this formula to convert it into the normal date format:
=IF(LEN(B218)=10,(MID(B218,4,2)&"/"&LEFT(B218,2)&"/"&RIGHT(B218,4))+0,IF(LEN(B218)=9,(MID(B218,3,2)&"/"&LEFT(B218,1)&"/"&RIGHT(B218,4))+0,IF(LEN(B218)=8,(MID(B218,3,1)&"/"&LEFT(B218,1)&"/"&RIGHT(B218,4))+0,"")))
Formula is working fine except on this type of date "9/9/2013"..i also tried an OR formula with mid but didnt get the desired result.These are the type of dates:
12/10/2013
12/9/2013
9/11/2013
9/9/2013
7/25/2013
View 9 Replies
View Related
Oct 21, 2009
1. I need to convert a year into a decimal year ie. 1830 into decimal year (I don't have a month, just year)
2 Year/month into decimal year/month
I just not sure what to do, is the year stored as a number/text/date. What should it even look like? Does 1830 display as 1830.00 using excel.
View 9 Replies
View Related
Jan 27, 2009
I use excel 2002 but some of my office are on 97, i want to add a small workbook open event code which works for me but debugs for the others?? The code is basically, go to a tab, on that tab and that range sort..
View 2 Replies
View Related
Feb 8, 2007
I've developed a little software using Excel Macros & VB. To prevent people from accesing the code I protected the code blocking it from visualization. It seems not enough as an acquaintance of a friend cracked it in 25 minutes. Or so he says. So I'd like to know if there is a better way to protect the font code.
View 8 Replies
View Related
Mar 9, 2013
I have an excel file having part code,name,vendor and Qty ( Quantity ).
My problem is that I want to apply an excel formula to pick up that vendor code who have highest Qty of a part code.The condition is that S.No.should not be disturbed.This file is so large,but here I have taken an example,
View 2 Replies
View Related
May 12, 2009
I am dealing with several very large spreadsheets using VBA to do various things. I found that my code worked well, but was taking a long time to run. The biggest time consumer was my use of the AutoFilter features. I have since turned calculations to manual before my code runs and set it back to auto when my code is done running. What are the potential consequences of my turning calculations to manual and then back to auto?
View 2 Replies
View Related
Dec 6, 2012
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 ?
Using :
MS Excel 2010
IE Explorer 8.0
View 1 Replies
View Related
Aug 1, 2013
My company has files that are already in use. I don't know too many details about how they work, but somehow saving the file will screw it up and my boss has to go back and reset something or other to correct it. Obviously it's connected to some other software somewhere. The code below will block Save and Save-As. BUT how do I get the file to hold onto the code without actually saving the file after the code is added (since the file shouldn't be saved)?
VB:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI = False Then
Cancel = True
[Code].....
View 1 Replies
View Related
May 13, 2009
I have some buttons in different sheets in an excel file, each button has its own code, that is the reason I can not move the code related to each object to another location (sheet or module).
And I have one piece of code in Module1 (Auto_load) in order to execute automatically this routine every time file is opened. Inside "auto_load" routine I initialize some values of some check buttons,options buttons and positions of some objects in diferent sheets, but I can not pass the value of variables between Module and Sheet's code even when I declare as public variables and/or function.
I have the following structure: ...
View 11 Replies
View Related
Jul 24, 2009
I'm trying to write a VBA script which will delete all rows in my Excel spreadsheet where Column I (which contains a status code) does not contain the word "Completed".
At the moment, I'm doing this the other way round: my script is able to search for entries in Column I which contain the status codes "Pending", "Awaiting Authorisation", "In Progress" etc and delete them. The idea is that when all those rows are deleted, I'll only be left with rows which have a status of "Completed". This works fine at the moment. However, the concern is that if a brand new status code is added to the data file, my script would be unable to pick it up and delete it. This is a small sample of the code I'm currently using (which deletes all the rows with statuses other than Completed):
View 4 Replies
View Related
Jul 30, 2009
I am trying to determine how to get the code below to fire whenever cell J10 is populated and do nothing when cell J10 is not populated but I can't quite get it. (Cell J10 is manually changed and is not changed based off of a formula)
View 4 Replies
View Related
Jul 25, 2014
Is there a standard way to organize sections of code with code tags? Due to the nature of my work, there is a lot of documentation involved. And, my spreadsheets rely heavily on VBA. These code tag sections will be going into a design specification, so that there is a layer of traceability from the document to the program. These are the general sections or item numbers that I've come up with.
1. Dimensions and Variables
2. Data
3. Processing the Data
4. Rules of analysis
5. Analysis
6. Formatting
I guess I'm looking for something standard like UML diagrams for DFDs, but with tagging code to break them up into sections?
View 4 Replies
View Related
Feb 2, 2009
I am using the code below that I got off of these forums to email a particular sheet in my workbook, but I need to strip all of the VBA code and the command button from the sheet being sent.
View 14 Replies
View Related
Feb 6, 2009
Can someone explian to me this line of code in eglish specially after the .Count /14-1
View 2 Replies
View Related
Dec 17, 2008
I have a macro that, when run, needs to read the contents of cell B5, and run the code that it contains.
Cell B5, for example, would contain the text:
Range("B13").Formula = "SUM(D12:D14)"
I need a macro to "execute this code", as if it were in the macro itself.
I have assigned the above to a variable, but am not sure how to execute it.
EG.
Dim the_calc
the_calc = Range("B5").value
Now, how do I run the_calc ?
View 9 Replies
View Related
Apr 3, 2014
I have problem to change text code into numerical code using macro. i have data contain text code and i would like to convert it into numeric . each text code has dedicated numerical code for example I have 4 fluids with text code text code:
FW = Fresh water
SW = Saline eater
CW = connate water
MW = Meteoric water
numeric code as follow
FW=1
SW=2
CW=3
MW=4
I would like to convert the text code into numeric code, it is easy if using excell , but it is routine job for me , i need to create macro to be more simple .
View 1 Replies
View Related
Sep 9, 2009
I am now trying to combine 2 sections of code but being a complete VBA novice I'm stuck, where should the second Sub go so that it works,
View 4 Replies
View Related
Sep 9, 2007
What is the most efficient VBA code for the following macro recorded codes? I wish to write more efficient code versus the lengthy, cumbersome macro recorder code.
1) Macro Recorder Code to Copy One Sheet to Another
Sheets("Data Apple").Select
Cells.Select
Selection.Copy
Sheets("Banana").Select
Cells.Select
ActiveSheet.Paste
2) Macro Recorder Code for Replacement Purposes......................
View 9 Replies
View Related