Posts

Showing posts with the label excel

VBA Webscrape not picking up elmenents; pick up frames/tables?

Image
VBA Webscrape not picking up elmenents; pick up frames/tables? Tried asking this question. Didn't get many answers. Can't install things onto my work computer. https://stackoverflow.com/questions/29805065/vba-webscrape-not-picking-up-elements Want to scrape a morningstar page into Excel with the code below. Problem is, it doesn't feed any real elements/data back. I actually just want the Dividend and cap gain distribution table really from that link I put into my_Page. This is usually easiest way, but an entire page scrape way, AND Excel-->Data-->From Web DON'T work. I've tried to use get elements by tag name and class before, but I failed at being able to do it in this case.This might be the way to go... Once again, just want that Dividend and Cap Gain distribution table. Not seeing any results in via the Debug.print Working code below, just need to parse into excel. Updated attempt below: Sub Macro1() Dim IE As New InternetExplorer IE.Visible = True ...

Periodically Copying Concatenated Data in Excel To Second Sheet While Primary Sheet Remains Active for Data Entry

Periodically Copying Concatenated Data in Excel To Second Sheet While Primary Sheet Remains Active for Data Entry I am pulling data from various cells on Sheet1 in Excel and copying the values to specific cells on a row in Sheet2 every specified period of time. I almost have my project completed but am unable to copy concatenated data in the same manner. How would I incorporate the following excel statement into my code for the data to be copied on sheet2 from sheet1? The output should go into cell AB on Sheet2. Not to confuse the issue but the reason the code is done in this manner is so that data can be entered on sheet 1 which will be the active sheet on the screen at all times but data will be periodically be saved to sheet2. Excel Statement i need to incorporate and output to Cell "AB" on sheet2: =CONCATENATE(Sheet1!I9,", ",Sheet1!I10,", ",Sheet1!I11,", ",Sheet1!I12) Current Code: Option Explicit Public dTime As Date Sub ValueStore() Dim...

define named range in Excel 2003 INDIRECTLY referencing another workbook

define named range in Excel 2003 INDIRECTLY referencing another workbook I am trying to define a named range in a particular workbook in Excel 2003. Specifically, I want to assign the name "Name" to a range (list of data) on, let's say, Sheet 4 of workbook "Hours". This list of data is itself an output of formulas referencing another workbook ("Task Break-Down"). For example, cell A2 of Sheet 4 ("Hours" workbook) ='[Task Break-Down.xls]Sheet2'!A2&"". When I create/define the named range as described above, it will show up in the list of named ranges when clicking ctrl F3. However, when I reference the named range in a formula (using "Name"), it doesn't work. Also, when I click the little drop down arrow next to the name box in the top left corner to display named ranges, "Name" does not show up. Any idea why? I am trying to use the range "Name" (again, consisting of outputs of formulas r...

Increment a counter every ten rows

Increment a counter every ten rows I have an Excel spreadsheet with more than 50,000 rows and want to add a column that effectively groups the data in sets of ten by assigning an increasing number to every ten rows heading downwards. To clarify, this is what I'm going for: Col A Col B Decile 1 * * 1 2 * * 1 3 * * 1 4 * * 1 5 * * 1 6 * * 1 7 * * 1 8 * * 1 9 * * 1 10 * * 1 11 * * 2 12 * * 2 13 * * 2 14 * * 2 ... 199 * * 19 200 * * 19 201 * * 20 ... The current way I have of doing this is to insert this function into the first entry of the Decile column and copy it down to the whole column: =INT(COUNTA($A1:A$2)/10) + 1 which counts all the rows from A2 to the current row, divides by 10,...

Excel VBA Macro: Scraping data from site table that spans multiple pages

Excel VBA Macro: Scraping data from site table that spans multiple pages Thanks in advance for the help. I'm running Windows 8.1, I have the latest IE / Chrome browsers, and the latest Excel. I'm trying to write an Excel Macro that pulls data from StackOverflow (https://stackoverflow.com/tags). Specifically, I'm trying to pull the date (that the macro is run), the tag names, the # of tags, and the brief description of what the tag is. I have it working for the first page of the table, but not for the rest (there are 1132 pages at the moment). Right now, it overwrites the data everytime I run the macro, and I'm not sure how to make it look for the next empty cell before running.. Lastly, I'm trying to make it run automatically once per week. I'd much appreciate any help here. Problems are: Code (so far) is below. Thanks! Enum READYSTATE READYSTATE_UNINITIALIZED = 0 READYSTATE_LOADING = 1 READYSTATE_LOADED = 2 READYSTATE_INTERACTIVE = 3 READYSTATE_COMPLETE = 4 ...

VBA coding for iterating online tag values from RSLinx

VBA coding for iterating online tag values from RSLinx I'm fetching online tag values from RSLinx into a cell in my excel sheet , and I've stored the online value of a fan output ( 0 or 1) in a different cell. Now i want to write a code in vba to iterate the value of the online tags into the successive rows for as long as the fan output is 1. Welcome to Stack Overflow. When you're worried about being vague in your questions please refer to this link to help you write your questions. Then people will be able to help you more effectively. – Lux Claridge Jun 29 at 17:30 What's an RSLinx? What is a "fan output"? What "Online tags"? How is your sheet set up? How are "Fetching online tags" from the RSLinx thing? Have you written any code yet and this...

Locating cells in an external workbook and copying over information automatically

Locating cells in an external workbook and copying over information automatically I am new to VBA and am trying to create an automatic filing system. I want to copy invoice information directly over from an invoice 'InvoiceMaker' workbook to a separate 'InvoiceTracker' workbook each time an invoice has been filled out. I have a long line of free invoice numbers in the 'Tracker' workbook and i want to assign specific information from each new invoice to each free invoice number. I have been writing to code to automatically search for the invoice number using 'find' in the column B where these free invoice numbers are located. Once this has been found the information in specific cells can be copied over directly to this row of cells. I have come across a problem with finding the location of the invoice numbers in the external workbook. The error message 91 keeps recurring 'Object Variable or With block variable not set', even though a name has been...

How to create an addin installer excel

How to create an addin installer excel I have a addin file named as VitaE.xlam . I want to make an addin installer of this file for my client. I have everything added, changed the ribbon using customUI, added all the macros etc. The final step is what I am not able to find anywhere. I just need to create a VitaE.exe file for installing all the addins that are created in VitaE.xlam . VitaE.xlam VitaE.exe VitaE.xlam By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Automate Filter Selection in Pivot table of Excel using macro

Automate Filter Selection in Pivot table of Excel using macro How can I jump to the first selection of a date filter in Excel? The filter is connceted to a cube and everyday new date gets refreshed and added to the filter automatically. I want to unselect the current selection and select the next date. And I want to build a MACRO for this task. Please suggest how to do it. This is Off-Topic, please don't ask how to do x without offering what you tried so far. If you want a tutorial on how to build a Macro for something like this please use google. Quote from stackoverflow.com/help/on-topic: Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it. Please take a look at How to Ask. – Paxz Jun 29 at 11:00 ...

Calculate cell only when column header equals a certain value

Calculate cell only when column header equals a certain value First time poster so any would be greatly appreciated. I would like to perform calculations on a given row only when the column header contains a value. Column A **Name** Column B **Test 1** Column C **H1** Column D **H2** Column E **Test 2** The above example will better explain what I'd like to do. I have a series of columns, some with test results and with homework results. Tests and Homework results can be in any order. What I would like to do is perform calculations such average, sum etc based on whether it is a homework or test. So that for example I would like to average all the homework results for a pupil (on a given row). Is this possible and if so how. I am using Excel 2010 if that helps. Maybe an example with figures will help describe your problem? – Jerry Oct 7 '13 at 8:56 ...

Add regular expression reference before running the macro vba

Add regular expression reference before running the macro vba code : Public Sub CallDeleteAllText(control As IRibbonControl) Call LeaveNumbers End Sub Public Function PullOnly(strSrc As String, CharType As String) Dim RE As RegExp Dim regexpPattern As String Set RE = New RegExp CharType = LCase(CharType) Select Case CharType Case Is = "digits": regexpPattern = "D" Case Is = "letters": regexpPattern = "d" Case Else: regexpPattern = "" End Select RE.Pattern = regexpPattern RE.Global = True PullOnly = RE.Replace(strSrc, "") End Function Sub LeaveNumbers() Dim cCell As Range For Each cCell In Selection If cCell <> "" Then cCell.Value = "'" & PullOnly(cCell.Text, "digits") End If Next cCell With Selection .NumberFormat = "0" .Value = .Value End With End Sub This code removes all text from the cell and leave all the numb...

Excel VBA code to loop through folders, combine files, create graphs then save in a different location

Excel VBA code to loop through folders, combine files, create graphs then save in a different location I am trying to write some VBA code however I am quite new to it. Every month I need to make 40+ reports for different sites from csv files. So far I have code to combine csv files and make one graph, however I need to make two more graphs from files that have near enough the same name only similarity is the beginning of "SimHistory". My thinking was to get all of the csv files combine them per site, put that data into tables, then to create graphs from that and then to save them in a specified folder for these reports. Each site has its own folder with 4+csv files and there are around 40+ sites I am able to get one of the graphs and combine the files but I cant work out how to loop through all of the folders and achieve everything that I want. Any help or skeleton code would be greatly appreciated Here is what I have been using so far: Combine: Option Explicit Sub CombineFil...

Copy values from different workbooks into a master file

Copy values from different workbooks into a master file So, at my work I am trying to create a master file which copies information from a fixed cell from different Excel files into a Master file. these values need to be written in different cells that are in the same row, but different column. My code can read through the files but does not paste any values in the cells, here is my code: Do While MyFile <> "" DoEvents On Error GoTo 0 Workbooks.Open Filename:=MyFolder & "" & MyFile, UpdateLinks:=False Range("J23").Select Selection.Copy Windows("MasterFile1.xlsm").Activate For c = 2 To 13 Cells(4, c).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Next c 0 Workbooks(MyFile).Close SaveChanges:=False MyFile = Dir Loop What worksheet is J23 on in the recently opened workbook? What worksheet is the destination on the master workbook?...

how to display my JSON object in good format in VBA Excel

Image
how to display my JSON object in good format in VBA Excel I know display my Parse Json in cell Excel when the Json is "simple" (when it's just string inside) but now i have String, object and array and i'm a little lost.. my json is following: [ { "name": null, "type": null, "actions": , "screen": null, "container": null, "sysid": 5, "uftitem": null }, { "name": null, "type": null, "actions": , "screen": null, "container": null, "sysid": 6, "uftitem": null }, { "name": "UTProject5", "type": "type", "actions": [ { "name": "UTProject", "description": "U...

Create a table using only specific columns in google spreadsheet or excel

Create a table using only specific columns in google spreadsheet or excel Concept of what I'd like to do Please checkout above image before reading this, So I want to create a table in which I want [X] columns, and based on length of rows it would search for specified values that will be found in columns and then make entries in rows.I've tried to explain it using the image. I hope it's clear enough. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

copy rows multiple times (given in a cell) and add unique id number based on cells

Image
copy rows multiple times (given in a cell) and add unique id number based on cells I have a big table containing data like this one (ProductName, ProductId, RepeatNumber) I would like to create a new dataset on a new Sheet (Sheet2). The macro would copy data from Sheet1 and it would Insert rows as many times as it can be seen in the column C (the enclosed macro can already do that) but i would like to place these data on a new Sheet (Sheet2) and to give an ItemId in the Column B on the new sheet (on Sheet2) which is created by ProductID. The first 5 character of the ItemId is the same as the ProductId and the last two one is 01, 02, 03 and so on until the repeatnumber. Since these original data on Sheet1 are changing continously, that is new rows are added on Sheet1, i would like an input box for giving the rownumber from where the macro needs to run. The first data (created by the macro) would be placed in the last nonempty rows of the column A of Sheet2. First time the input value wo...