I have some VBA that dumps various sheets data into an SQL Database.
Part of that requires me to sanitize all of the fields before they make it to the DB, (at least to prevent the code from breaking itself w/ errant ' characters.
right now my code is as follows
Code: If InStr(aa, "'") > 0 Then aa = Replace(aa, "'", "''") End If If InStr(bb, "'") > 0 Then bb = Replace(bb, "'", "''")
[Code] ......
I was hoping to condense it to something like the following, however it is not working how I hoped / want it to. .. I had found somewhere out there that this Eval() function possibly could be used to 'reference' dynamic variables, however it does not appear to work at all anymore, and even then it may only have worked to 'read' and not 'write' to the variable. (Excel 2010, on Windows 7 64-bit).
I am attempting to use a previously Set variable as part of the next Set statement, pretty unsuccessfully at present.
My purpose is trying to look up
Code: tb_SelJobID.Value
from a userform in Col Z then look across the row to Cols D,I,N,S & W (different types of work) to see if
Code: TbSelYr.Value
matches the year selected then insert a formula in the row to the left. Then loop down to the FinalRow.
Currently my Set Found1 statement does not recognise my Found10 value. I know it will be my syntax as it always is. I have cut down the following code to display where the problem areas are, Found1 thru 5.
Code:
Sub CmdGo3_Click() Dim Row As Range Dim FinalRow As Long Dim Found1, Found2, Found3, Found4, Found5, Found10 As Range Application.ScreenUpdating = False
I tried Conditional format and no luck. (Office 2010)
What I'm trying to do VB is:
If Cell B:B has value of "402" or "up" and Cell C:C is less >100 Then Change color on Cell C:C to "yello, red, etc" (if C value is <100 no color change)
Run-time error '-2147467259 (80004005)': An unexpected token ""20*"" was found following "1' AND PERIOD = LIKE*. Expected tokens may include: "". SQLSTATE=42601 code died at RS.Open SQL, CN ///////////////////////////////////////////////////////// Sub GET_OSI Dim sn as String, osi as string, saposi As String
I need some different columns within a row to calculate based on a statement found in an earlier column in the row. something similar to below. there will only be two statements total which are noted on the table below.
A B C D E
1 0 0 20 5%
[Code].....
So basically If column A = disposition calculate D and E in column B but if Column A = Receipt calculate in column C
The formula for D and E is not exactly as shown just using that as a quick example. I'm using office 2010.
I am using MS Excel 2010 want what to change a number of cells if a value is true e.g.
Row one has the headings Prz, Stat, Val, andPts Row two has the following values :- (Prz) a2 =2, (Stat) b2=1, (Val) c2=$30, (Pts) d2=10 How do I do the following in Excel :- IF B2=1 THEN A2+1 AND C2+30 AND D2+5 so that the above cells are changed to (Prz) a2 =3, (Val) c2=$30, (Pts) d2=10
I was able to use pivot table to set up the balance sheet and income statement.
1. now each month is a field which I can choose to add to the report, but the field list is getting too long (and growing). Is there a way I can insert 1 field (for the user to input the exact date) or 2 fields (to input year and month) and the pivot table can pick up the input and refresh either automatically or manually.
2. I looked into the "group" function in pivot table, but how do I group the above data in quarterly and yearly fashion so the user can get those information quickly?
Excel 2010, I have the following list (showing part of it):
Name T-Shirt Sizes Nathan S
[Code]....
The aim of the list is to see what Sizes each and every person needs and then count how many T-Shirts are required for that particular size. The list is over a 100 entries long so counting it manually isn't really an option as it's time consuming as well as errors might arise.
Thus, I've been trying to use the IF statement with the following logic but to as no avail
IF Size in Column is XS Add 1 to a particular Cell IF Size in Colum is S Add 1 to a particular Different Cell
and so on for the other sizes...kind of like a counter for a for-do-loop.
excel 2010. This workbook has 4 worksheet(Process Engineer,OSBL,OSA,Lab Operator) I want to know what is the best excel formula/function to summary this 4 worksheet.
Example:I want a formula/function to summary all the statement from 4 worksheets and total number of answer "1" per statement from 4 worksheet.
Sample Statement below
"Demonstrate Interpersonal (People-to-People-) Skills" Question:What is the formula if above statement contains this statement in 4 worksheet?As i checked the total is 4 then What is the formula to get all total answered ICC on this statement from 4 worksheet?
I want to ask if there is a way to simply extract non-empty rows from a data set consisting of many rows filled with zeroes and some which are filled with the non-zero values. By “simply” I mean without using any macros. Any help or suggestions are highly appreciated. Dima
I have attached the workbook with example of the sheet with such data set (CLEAN tab shows the desired result of this operation): [url]
We have a large table on one worksheet that has specific information that we want on a second worksheet.
We can use VLOOKUP to get one line of information transferred over to the new worksheet, but how to bring many lines of data over.
In the attached example, we want ONLY the RE or RO or RL lines of data in worksheet "ALL CREDIT CARDS" to be listed on the new worksheet "RE RO RL CREDIT CARDS".
Let's assume, starting at A1, that i have table (8c x 30r) and lets assume that in each of the columns i have 5 cells filled in with data at random. What is the best way for me to produce a list of the data in each of the columns without having to go in and delete out all the blanks myself? I.e. i want to reproduce the table but without any of the cells which do not have any data in.
I have a pretty slick macro that once ran will save the spreadsheet and copy the input to a master sheet, so far it is very functional. I borrowed most of the code from within this forum, as VBA is not my strong point. My problem being that when the script runs and posts the output to the master sheet, it is pasting formulas. I need it to strictly paste the values in, otherwise my master sheet is referencing hundreds of other worksheets.
Sub Finished() Dim iReply As Integer Dim countColumn As Integer Dim MyFullName As String MyFullName = ThisWorkbook. Name iReply = MsgBox(Prompt:="This will upload your tracker and exit, Are you sure?", _ Buttons:=vbYesNo, Title:="")
I am trying to send bulk emails from my excel 2010 - however I am getting a POP UP. find the screen shot in the enclosed word document So every time a new mail is sent from excel we need to press the button allow Is there a way where I can turn off this warning.
I have created a macro in excel 2010 which enable the file to save (extract) data into separate location and name. The vba code for macro is as follows: Question: How can I save this workbook with reference to the value containing in cell B2? (it is named temporary now - as defined in the code)
Recorded macro. The hope is to insert a excel formatted table a set number of times. I have found a loop code that references a Cell A1 and repeats that amount of times. So if A1= 10. There should be 10 tables inserted. However on the second time there is a fault with the table name. I need the name to change each time the loop is run. ie Table1, Table2, Table3 etc up until the loop stops (A1 contents).
I am using excel for windows 2010. The macro that i have so far is below.
Sub LoopTest() Dim n Dim V Range("A1").Select V = ActiveCell.Value
I am having an issue getting an IF statement to work inside a DO loop. I have Microsoft Excel 2007 and Windows 7 Entreprise.
In my Excel spreadsheet, I have in column B a list of keywords and in column C the category to which each keyword belongs. For instance, the keyword "boot" goes withe the category "Shoes", "scarf" goes in "Accessories", etc.
In another column, I have a list of product descriptions (like "Black Boots" or "Silk Scarf") and I would like to assign the relevant category to each product. I thought to do this by creating a new function in VBA. This function would go through the whole list of keywords in column B, checking if the keyword is included in the product description. If it is, the function's result would be the relevant category, and if it is not, the function would search the next line in column B, until a relevant keyword is found, or until the end of the list.
Here is the code I have written so far:
Code: Function SegmentSearch(Item) Dim i As Integer i = 1 Do i = i + 1
If Application.WorksheetFunction.IsNumber(Application.WorksheetFunction.Search(Sheet5.Cells(i, 2), Item)) = "TRUE" Then SegmentSearch = Cells(i, 3) Loop Until Application.WorksheetFunction.IsNumber(Application.WorksheetFunction.Search(Sheet5.Cells(i, 2), Item)) = "TRUE" End Function
Without the loop, the function works fine (if "Item" happens to include the first keyword in the list) but as soon as I try putting the loop I get a #VALUE! error.
I am using Excel 2013 on a windows 8 machine. It may be easier for me to explain the problem, before posting about the formulas. I maintain a retirement residence with alot of phone numbers. I have a list of all the numbers we own in one column and the numbers assigned to the PBX systems in a second column. By using a If formula I can tell which numbers have not been assigned (The true statement). My problem is when a resident passes away, I need to reuse that "phone number", but I dont want to reuse the number too soon. I am hoping to use the "true" from the if statement to generate a time stamp. I plan on using that time stamp against the "today()" in a days formula, I believe this will spit out the number of days a number has been idle. The time stamp would be constantly changing or removed as the if statement would always be changing. So column C gives the True statement and says "Number not Assigned" - this should create a time stamp in Column W
And looking from right to left, I am asking this question:-
If K8=J8, then I will have K8 & I8 as my result. If K8=I8, then I will have K8 & H8 as my result. If K8=H8, then I will have K8 & G8 as my result. If K8=G8, then I will have K8 & F8 as my final result, Else its K8&J8 as my FALSE. (the $J$3 = a comma, for number separation, and further LEN string capture.)
Every time I have made this formula, with other types of Logic, it only ever finds the second tier depth as the result, and I wonder why, since they are several nested IF statements in line!!
The incomplete Excel sheet is attached : S 1_2 tracker Forum.xlsx
The result of the above formula should be 4,10 But instead I get 4,4
Background: The user makes a selection from a drop down box on the main sheet (sheet5, G12). The drop-down box is linked to *Sheet31.Pax_Nav*. If the drop-down box's linked cell value is less than 5, then do nothing (manual input required). If it is greater than 5, then the vlookup matches that number to a person in the database and returns their weight. The code will pull the required person's weight but then Excel will hang and freeze.
Private Sub Worksheet_Calculate() On Error Resume Next If Sheet31.Range("Pax_Nav") > 5 Then Sheet5.Range("G12").Value = Application.WorksheetFunction.VLookup(Sheet31.Range("Pax_Nav").Value, Sheet31.Range("H17:L48"), 5, False) Else End If End Sub
Cell BM22 is a percentage calculation of the differences between two different days of volume for this stock and that formula is: =(BH22/BH25)-1 Cell BM22 currently is calculating the result to be -65.65%
When I set up a CLASSIC Conditional Formatting using a formula (="If($BJ$20=""SELL""") to check the if the text in cells BK10 match the text displayed in cell BJ20 - I get no error messages and no formatting?
I am using Mac Office Excel 2011. I feel like I have tried everything including changing the Number selection type of the cells to TEXT. Nothing seems to works.