Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I just have a quick Visual Basic question about Formula R1C1... I've
incorporated into my query code... The Code is as follows; Sub Button9_Click() ' Cost Element Button 'This part of the code clears the other filters Worksheets("WBS Query").Range("B4,E6,G4,J4,M4").ClearContents Sheets("WBS DATA").Select Range("R2").Select ActiveCell.FormulaR1C1 = "4100" 'This part of the code Copies and pastes the criteria Worksheets("WBS Data").Range("Q2:T2").Copy ActiveSheet.Paste Destination:=Worksheets("WBS Data").Range("Q3:T3") Set Company = Worksheets("WBS Data").Range("R1") Set Query = Worksheets("WBS Data").Range("WBS_Charges") Set Criteria = Sheets("WBS Data").Range("r1:R2") Worksheets("WBS Data").Range("R1").Calculate Query.AdvancedFilter Action:=xlFilterCopy, _ CriteriaRange:=Criteria, _ CopyToRange:=Range("A11:M11"), Unique:=False 'This part of the code copies Q3:T3, pastes it back to Q2:T2 and deletes Q3:T3 Worksheets("WBS Data").Range("Q3:T3").Copy ActiveSheet.Paste Destination:=Worksheets("WBS Data").Range("Q2:T2") Worksheets("WBS Data").Range("Q3:T3").Clear End Sub If I manually enter 4100 into cell R2 it will query the database... It will also work if I let the code put it in, but not run the query, then block out; 'Sheets("WBS DATA").Select ' Range("R2").Select ' ActiveCell.FormulaR1C1 = "4100" then run the query... But if I let the all the code run, it gives me "Run time error "1004", The extract name has a missinng or illegal field name... Any help would be greatly appreciated, Thanks, Kevin... |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Use MS Query to query data within the current work book | Excel Discussion (Misc queries) | |||
Excel Query Does not Work | New Users to Excel | |||
web query on EXCEL does not work. Why? | Excel Discussion (Misc queries) | |||
web query doesn't work | Excel Discussion (Misc queries) | |||
Can't get Web Query to work | Excel Programming |