Simplifying QueryTable Request Code
Jul 10, 2008
I have the following code which works but is slow. All the code is the same except the address part and the destination range. Any help simplifying would be great. Also, every time I run the sub it asks me if I want to replace the destination cells. Is there any code to circumvent that? Lastly, although the second and third query requests have a different destination range, excel shifts the previous query to the right, hence first command after final query request.
View 10 Replies
ADVERTISEMENT
Dec 5, 2008
See the attached spreadsheet with a macro that gets the querytable in Sheet1. In sheet2 there is a formula to get one of the balances from the querytable result. Is there a way to find the balance on sheet2 from the querytable at runtime so that I do not have to download it to Sheet1? Then I could do away with Sheet1 altogether.
View 2 Replies
View Related
Jun 18, 2014
Every time I try to add the contents from the request form to the Master CCO tab, the information does not dump. The only way the form will close is if i hit the cancel button. I don't know what I've done wrong with the add request code.
View 1 Replies
View Related
Feb 20, 2014
The below code uses data in column "A" (Const cl& = 1) to create a sheet for every unique value in column "A".
I would like for the code to request what column to use as source data. As an example when the code first runs a pop-up box would ask for a column letter to use as the source, after entering the letter (or corresponding column number) the code will execute.
Code:
Sub Add_sheets_from_A()
Range("XA1") = ActiveSheet.Name
ActiveSheet.Name = ("Add_Sheets")
[Code]....
View 3 Replies
View Related
Feb 8, 2010
I'm using Excel 2003. I have been using SUMPRODUCT to look at too compare columns and data that is contained in both. Column L11:L52 contains the numbers 1 to 4 and Column K11:K52 contains the word YES in some cells. I just want to look and see if text is contained in a row in column L is it contained in that row in column K. This is the formula I'm using but it seems over complicated and I'm sure there is a way of just looking if the cell contains information without worrying what it is.
=SUMPRODUCT(--(Data!$L$11:$L$52=1),--(Data!$K$11:$K$52="YES"))+SUMPRODUCT(--(Data!$L$11:$L$52=2),--(Data!$K$11:$K$52="YES"))+SUMPRODUCT(--(Data!$L$11:$L$52=3),--(Data!$K$11:$K$52="YES"))+SUMPRODUCT(--(Data!$L$11:$L$52=4),--(Data!$K$11:$K$52="YES"))
View 3 Replies
View Related
Jun 11, 2007
I have a csv archive file on a remote server that I am accessing with excel. The problem, if I use QueryTable, all info is placed in the first column. If I use the workbook.open method, the info is placed in the proper cells, but it is in a seperate workbook.
So, how do I get the workbook.open results, except in the active workbook/worksheet? Or, is there a way to QueryTable (my preferred method) and get it into seperate cells?
Here is my
Sub RemoteFile()
Dim csvfile As String
On Error Goto ErrRemoteFile
Call CreateBatchFile
Call CreateScriptFile
View 4 Replies
View Related
Dec 30, 2009
When a QueryTable is refreshed and the number of rows it returns changes, I *expect* that a corresponding Named Range should be automatically resized. The sheet-level Named Range (same name as the QueryTable) should cover the query result's header row and all returned data rows.
But now I've got a Named Range that seems to have become disconnected from its QueryTable. The query returns fewer rows but the Named Range stays the same size.
This is even more perplexing because the aberrant QueryTable is right next to another QueryTable that is behaving normally. The Data Range properties of both are identical.
View 4 Replies
View Related
Sep 26, 2011
How do I handle URL connections - such as logging into a web application?
Example 1
When I use .Refresh BackgroundQuery:= False and there is a problem connecting, Excel hangs ... cannot Ctrl-Break ... only option is to kill Excel (and lose changes).
global QT As QueryTable
Set QT = ActiveSheet.QueryTables.Add(Connection:="URL;" & vLoginURL,
[Code]....
Now, if it's still refreshing, it's ok. But if not, it gets stuck on .Refreshing with run time error 424.
Ideally I want to use .Refresh BackgroundQuery:= False as I am calling a number of urls. I just need to provide an "out" when the url fails and hangs on .Refresh BackgroundQuery:= False
View 6 Replies
View Related
May 5, 2014
I have a series of rows and columns. Each intersection has a formula. I want to be able to manually enter text in the cells that contain formulas but then click a button next to the row if I want the formulas back. Here's what I have written so far. Is there an easier way to write these OR is there a more streamlined way of accomplishing what I'm after? There will be about 39 rows and 39 associated buttons.
(The screenupdating lines are there just because I don't want the screen to flash in any way when I click the button)
Code:
Sub Button1_Click()
Application.ScreenUpdating = False
Range("C28") = "=IF(AF74=0,"""",AF74)"
Range("G28") = "=IF(AG74=0,"""",AG74)"
[Code].....
View 1 Replies
View Related
Jun 17, 2014
I have written a formula to convert military time to 12-hour format.
View 3 Replies
View Related
May 9, 2014
I have a macro which builds a report to be sent out daily, however some days there are no updates in certain categories.
The macro copies over certain template lines from a template report, then filters the formatted data sheet and copies the rows over to a report the problem is that certain days the filter returns no rows, so I put in a lengthy if statement
Here is the code I am currently using, I would like to simplify it (the entire macro would run this about 20 times over for different sections).
[Code] ......
View 1 Replies
View Related
Jul 28, 2006
I have a querytable running on my sql database. In the query I have a trimleft function because the numbers are stored with several proceeding blank spaces. When I execute the query through my macro, everything works fine, except I can't average or sum the results. They can be multiplied, divided, etc, but not averaged or summed (they just show as zero on summing, which makes the average DIV/0). The really strange part is that if I select a number and go to the formula bar and hit delete at the beginning of the number (which actually deletes nothing), the number is suddenly capable of actually performing as a number. I assume this has something to do with how the querytable is returning my results, but does anyone have an idea for a workaround for this issue?
View 3 Replies
View Related
Aug 22, 2006
I have a bunch of workbooks that are used to capture information about implants used in surgical cases. I use a small VBA process each morning to update a querytable which contains all of the core patient information for future cases, however it is not working properly. The code goes through the process OK, or so it appears, opens and closes each sheet, and saves them appropriately, but the query table doesn't seem to refresh no matter what I do.
Sub RevisedRefresh()
Dim lCount As Long
Dim wbResults As Workbook
Dim wbCodeBook As Workbook
Application. ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
On Error Resume Next
Set wbCodeBook = ThisWorkbook
With Application.FileSearch
.NewSearch
.LookIn = "G:SHSTheatreCommonReceptionImplants"
.FileType = msoFileTypeExcelWorkbooks
If .Execute > 0 Then
For lCount = 1 To .FoundFiles.Count
Set wbResults = Workbooks.Open(Filename:=.FoundFiles(lCount), UpdateLinks:=0)...............................
View 3 Replies
View Related
Feb 20, 2014
I've got a SUMIF formula that works but will be complex to expand. Excel 2007
A10= SUMIFS(b2:b4,a2:a4,">="&B6,a2:a4,"="&B6,c2:c4,"="&c6,a2:a4,"="&c6,c2:c4,"
View 6 Replies
View Related
Jun 16, 2014
simplifying a formula which gathers data from about 50 worksheets from within the same work book.
The data to be gathered is in the same cell on each worksheet and is simply a number but i want the SUM of theses numbers carried forward to another worksheet. Each worksheet is named by date i.e. sheet 1 is named "16 June 2014" and sheet 2 is named "23 June 2014" and so on until "30 March 2015" (Each sheet represents one full week Monday - Sunday).
View 5 Replies
View Related
Jul 12, 2007
I have Time Data in one column, and Values in the next, and then a blank column (for calculations, like subtraction/time).
Is there any way to automate the =Cell2-Cell1 command for regions of blue cells and have it paste the value in the blank column lined up with the first blue cell of the region?
The attachment will make more sense, but this is what I'm talking about:
Before subtraction macro:
BlueTime1 Value Blank BlueTime4 Value Blank
BlueTime2 Value Blank BlueTime5 Value Blank
BlueTime3 Value Blank BlueTime6 Value Blank
Blank Blank Blank Blank Blank Blank
BlueTime7 Value Blank BlueTime10 Value Blank
BlueTime8 Value Blank BlueTime11 Value Blank
BlueTime9 Value Blank BlueTime12 Value Blank
After subtraction macro:
BlueTime1 Value BlueTime3-BT1 BlueTime4 Value BlueTime6-BT4
BlueTime2 Value Blank BlueTime5 Value Blank
BlueTime3 Value Blank BlueTime6 Value Blank
Blank Blank Blank Blank Blank Blank
BlueTime7 Value BlueTime9-BT7 BlueTime10 Value BlueTime12-BT10
BlueTime8 Value Blank BlueTime11 Value Blank
BlueTime9 Value Blank BlueTime12 Value Blank
View 11 Replies
View Related
Apr 10, 2008
I have a sheet with the data in the following way(its just a sample).................
now where ever i have ave i need to get the average of the range below it. Example: for the first ave i should calculate ave of new two rows cause the next row would be the ave of next range. I have close to 15000 rows and 135 columns of data like this.
View 4 Replies
View Related
Feb 11, 2005
I have a column of a few hundred numbers (price's). All the price's in the whole column need to be calculated with this formula: (price/119)*100. how to do this in excel 2003?
View 8 Replies
View Related
Jun 1, 2006
Formula request
I need to ( in currency)
Example
Col B = $2.06 . Col C = $3.42
I need to in Col D to calc the difference between B and C less 25%.
So in the above example D should = $2.90
View 6 Replies
View Related
Apr 3, 2007
"Prevent Outlook Access Request" but it kept binning the Request Part. So sorry in advance for the misguidance.
Second up :-
when i use the below code
Private Sub CommandButton22_Click()
Sheets("Sheet1").Select
Range("A1:Z1").Select
Selection.Copy
Workbooks.Open ("\ifdata002opsqual$Quality_and_RiskLive LogLive Log2.xls")
If ActiveCell.Value = Empty _
Then ActiveCell.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False _
Else:
Do Until ActiveCell.Value = Empty
ActiveCell.Select
ActiveCell.Offset(1, 0).Select
Loop
Outlook always asks "A program is trying to access Outlook - do you want to prevent access or allow" (or words to that affect) then you choose a time you allow it access.
Is there a way to prevent that daft wee box appearing - is this an Outlook issue more than excel? If it is outlook is there any way i can code it into excel to prevent the request coming up?
View 8 Replies
View Related
Jan 6, 2014
I facing a problem to generate request id number. Actually i need to generate id like example "RQ1013-01" where "RQ" is constant word, "1013" is month and year while "-01"is generated number. and every month i want the id number start from -00 back. thus in a month there is only 99 request is available.
View 6 Replies
View Related
Apr 12, 2012
I'm trying to find a formula for calculating the number of business hours a service request may be open; this request may have been opened and even closed outside of business hours. I found a formula that appears to be working:
=(NETWORKDAYS(StartDate&TimeCell,StopDate&TimeCell,holidays)-1)*(CloseTimeColumnLetter$CloseTimeRowNumber-OpenTimeColumnLetter$OpenTimeRowNumber)+IF(NETWORKDAYS(StopDate&TimeCell,StopDate&TimeCell,holidays),MEDIAN(MOD(StopDate&TimeCell,1),CloseTimeColumnLetter$CloseTimeRowNumber, OpenTimeColumnLetter$OpenTimeRowNumber),CloseTimeColumnLetter$CloseTimeRowNumber)-MEDIAN(NETWORKDAYS(StartDate&TimeCell,StartDate&TimeCell,holidays)*MOD(StartDate&TimeCell,1),
CloseTimeColumnLetter$CloseTimeRowNumber, OpenTimeColumnLetter$OpenTimeRowNumber)
What I don't know is HOW it works, I don't know what any of those formula's mean (with the exception of NETWORKDAYS). I'm trying to "show my work".
View 1 Replies
View Related
Jun 5, 2009
I am looking for a formula that will search a range on multiple worksheets for the FIRST blank cell and then make that cell the current active cell.
View 9 Replies
View Related
Feb 8, 2014
I would like to repeat a formula and make its dynamic depending on the request.
The formular that I would like to repeat is:
=IF(ISERROR(INDEX(Data!$A$2:$G$14997,SMALL(IF(Data!$A$2:$A$14997=$D$2,ROW(Data!$A$2:$A$14997)),ROW(985:985))-1,3)),"",INDEX(Data!$A$2:$G$14997,SMALL(IF(Data!$A$2:$A$14997=$D$2,ROW(Data!$A$2:$A$14997)),ROW(985:985))-1,3))
View 2 Replies
View Related
Jun 28, 2013
Right now when I send/receive an HTTP request, I have the text displaying in a MSG Box. I want to just have the text inserted into cell A1 instead. I know I have to alter MsgBox MyRequest.ResponseText, but anything Ive altered it to, doesn't seem to work.
Code:
Sub http()
Dim MyRequest As Object
Set MyRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
MyRequest.Open "GET", _
"Google"
' Send Request.
MyRequest.Send
'And we get this response
MsgBox MyRequest.ResponseText
End Sub
View 2 Replies
View Related
Mar 27, 2014
Warrantee.xlsx
I attached the sheet that I am trying to get up and running, there is two things I need to do, but cant get it working as I intend to.
Sheet 1 - When the invoice number is fulled in in cell F8 a message box must pop up requesting the hyperlink to the invoice saved on a share folder, but for now on the desktop, when the file is selected it (the hyperlink) must be returned to cell G8, then once the last cell (I8) has been completed, the line 8 must be locked so that it can't be editted again without a default password and a new line must be added below line 8 for processing, I tried recording the macro, but it only works on one line, and on the message box request, I truly am not up to speed yet, this I can't get up and running.
Excel 2010
View 2 Replies
View Related
Oct 3, 2012
I have a macro which refreshes a query when the spreadsheet is opened. This works fine when online.
However, if the user is not online, the query is unable to refresh and the macro just hangs.
Is there a code which will enable me to say " if unable to refresh then move on to the next line"?
here's the code below.
Private Sub Workbook_Open()
Sheets("Houselist").Activate
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("Front").Select
Range("A1").Select
End Sub
View 2 Replies
View Related
Nov 17, 2007
see my attached sheet cotaining the following questions. in a day report sheet how should i count request matching the crateria of date and other conditions. in a monthly report a heavy conditional sum calculation which make slower sheets how can i make it faster.
View 2 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