Posts

Showing posts with the label excel

Run Time Error on Active formula in Excel Macro code

Run Time Error on Active formula in Excel Macro code I want to use the value of cell A5 of Sheet 2 to my active formula in macro in Sheet 1. However, I'm getting an Error 1004 (application defined or object defined error). If using a static value, for instance 100, instead of 'Sheet 2'!A5 , it is working. 'Sheet 2'!A5 Below is my code: ActiveCell.FormulaR1C1 = "=if('Sheet 2'!RC>'Sheet 2'!A5,""PASS"", ""FAIL"")" 1 Answer 1 You cannot mix-and-match xlA1 cell references with xlR1C1 cell references. A5 is R5C1 in xlR1C1 syntax. ActiveCell.FormulaR1C1 = "=if('Sheet 2'!RC>'Sheet 2'!R5C1,""PASS"", ""FAIL"")" Now in this formula, the RC is a relative row/relative column reference to the same cell on 'Sheet 2' that the active cell on the active ...

How can I loop through my “getElementById” VBA for multiple websites?

Image
How can I loop through my “getElementById” VBA for multiple websites? I'm part of a non-profit that sends letters to encourage hundreds of people in prison. They are often transferred unexpectedly, with no time to give notice of address change. However, each person's location while incarcerated is kept up-to-date and publicly accessible on the state government's website. I am trying to write VBA that goes through my "contact" list and visits each state government's prisoner location website (based on each prisoner's ID), then extracts each person's location from the website, places that in a column ($C) for that purpose which corresponds to the row for that specific person's name & ID. That way I could run a check automatically to confirm each one is still at the same location before I do an Excel mailmerge to print envelope labels with their addresses. Here's what I'm using to get the correct value (I've just been testing with a ...

How to import an .xlsx file into a SQL Server database on MacOS?

How to import an .xlsx file into a SQL Server database on MacOS? I've set up an SQL server using Docker on MacOS computer. I've also installed SQL Operations Studio as a GUI. In SQL Operations Studio I'm trying to import list "Data" from a multiple-sheet AllData.xlsx file into a newly created table "Data_test" in my database "TestDB" using this chunk of code: USE TestDB; GO SELECT * INTO Data_test FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0; Database=/Users/user_name/Desktop/AllData.xlsx', [Data$]); GO I am getting an error like this: "The OLE DB provider "Microsoft.ACE.ODBC.12.0" has not been registered." Is there any way to solve this issue? A question like this has already been attempted to answer by this link. It is advised to use ODBC instead of OLEDB, but the link given in the answer refers to importing into Excel from a database, which is the opposite of what I'm trying to do. Overa...

Excel VBA editing comment if exists

Excel VBA editing comment if exists My code is checking if cell value from 2 sheets are different, if no it continue check for next row, if different it copy from sheet2 to sheet1 the cell value where I need and add to Cell in sheet1(where the value copied too) a comment with the old value. every time when the value changed again it remove the comment and put new one. I need to do a comment check if exist and append the old value to comment. I want that the comment will contain all the old values that changed in the cell. this is my piece of code: If Not IsEmpty(datasheet.Cells(iData, j).Value) Then comm = user & vbNewLine & "Old Date:" & vbNewLine & ActiveCell.Value datasheet.Cells(iData, j).Copy Destination:=ActiveCell With ActiveCell ActiveCell.Interior.ColorIndex = 0 With ActiveCell.Borders ...

Data driven coded UI test with excel file as a data source

Data driven coded UI test with excel file as a data source I built a coded UI test and I want to make it a data driven test , I want to get the data from an excel file ( Data.xls )located in the same directory with the project files, I used this line as shown in the MSDN site , but it didnt work , what changes should I do to the line ? [DataSource("System.Data.Odbc", "Dsn=Excel Files;Driver={Microsoft Excel Driver (*.xls)};dbq=|DataDirectory|\Data.xls;defaultdir=.;driverid=790;maxbuffersize=2048;pagetimeout=5;readonly=true", "Sheet1$", DataAccessMethod.Sequential), TestMethod] thank you Providing the error message you get will help us answer your question. – Eric Scherrer Apr 24 '14 at 12:38 @EricScherrer The unit test adapter failed to connect to the data source or...

VBA, i want to import a txt file to excel and I want it to be reorganized to a specific format [on hold]

VBA, i want to import a txt file to excel and I want it to be reorganized to a specific format [on hold] I have a txt file in the format below ,I want to import it to excel and I want it to be reorganized using Vba code. Timestamp : ##/##/## ##:##:## ## PM File # : #### Type : LLLLLL Range : #####:#####-#####/#(#-###) #####:#####-#####/#(#-###) #####:#####-#####/#(#-###) #####:#####-#####/#(#-###) #####:#####-#####/#(#-###) Stat : N/A ________________________________________________________________________ Timestamp : ##/##/## ##:##:## ## AM File # : #### Type : LLLLLL Range : #####:#####-#####/#(#-###) #####:#####-#####/#(#-###) #####:#####-#####/#(#-###) #####:#####-#####/#(#-###) #####:#####-#####/#(#-###) #####:#####-#####/#(#-###) #####:#####-#####/#(#-###) #####:#####-#####/#(#-###) Stat : N/A ________________________________________________________________________ . . n Repeated "n" times , "n" changes daily and I would like to import it to excel reorgan...

Excel - Turn off the window that asks you to change links to a workbook

Excel - Turn off the window that asks you to change links to a workbook I generated links to some 100 workbooks but not all of them exist. This is fine because if they do not exist it usually means I don't need it. The links are generated based on string concatenation, and the final step is to paste by value to a cell. A sample of the link may look like this "='P:TEMP[wb1.xlsx]sheet1'!$D$1 "='P:TEMP[wb1.xlsx]sheet1'!$D$1 What I need now, is to remove the first quotation mark to bring the link "alive". I wrote a macro that does the find and replace in the row Sub BringAlive() Rows("18").Select Selection.Replace What:="""", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False End Sub The only issue with this is that when a workbook doesn't exist, a window pops out asking me to find the workbook. I need to hit ESC many many times until the ...

Dependent drop down list for multiple cells

Dependent drop down list for multiple cells i want to create a Dependent drop down list in excel and i have a small doubt in it.i have one main table and one dependent table,Main table have 6 choices and in that 6 only one choice need dependent drop down list,when i create the Dependent drop down list,it work for only one cell,but the choice may repeat may times and i need to select Dependent drop down when ever the choice selected in that coloumn. I used formula for DDD list is =INDIRECT(SUBSTITUTE(B2," ","")),My doubt is how can i select B2 to B1200,and when ever my choice repeat, i need Dependent drop down list should come,Hope my Question has understandable . I Have a table shown below Booking confirmation Booking update Booking cancel Loadlist/SE File SLI Reviewed Other updates Cargo receipt On board Sailing schedule and i have Dipendent table only for Other Update 6th one in above order Vessel Rollouts Loadlist revision no update found when i select Other up...