I have a worksheet of about 388 items that each item is exported into a template worksheet that is created to itemize each item. It creates the worksheets but I can't get it to stop looping at the line of code in bold comments icons. The line that it stops at is to name the worksheet from the column "A" of the list of 388. I have shorten the list to work on the code. So when I'm done I would have workbook of 388 worksheets from the template made. The template worksheet name is "wbs_template" (hidden). I have attached …

Member Avatar
Member Avatar
+0 forum 1

I have 2 sheets in same Excel. First excel sheet contains the following fields No Material 10th july 11th july 1 DATUM DCP ESD Black 2 DATUM DCP ESD Blue My second worksheet contains the following fields No Date Material Stock size+Wastage 1 10th july DATUM DCP ESD Black 283.47 2 10th july DATUM DCP ESD Black 661.6 3 11th july DATUM DCP ESD Blue 665.6 4 11th july DATUM DCP ESD Black 50.8 I want the following Expected result in the first worksheet:- No Material 10th july 11th july 1 DATUM DCP ESD Black 945.07 50.8 2 DATUM DCP …

Member Avatar
Member Avatar
+0 forum 1

Hi thaks in advance if I am steered rightly I have created a form in which a combobox and a submit button are present. when i select an integer value from combobox (Ex: 5) and click submit button, those many number of textboxes (Ex: 5) are to be created dynamically in the same form using a for loop... I have created.. but its not working.. Can anybody help pls..

Member Avatar
Member Avatar
+0 forum 2

Hi, I need to write a macro that has one row of dates. Row D. I need the macro to go down row and depending on the date I need to input a number to the cell to the right of that date. Example. If date < 12/22/16 insert value 0 if date >12/22/16 but < 12/31/16 insert value 1..... and so on. I am not sure much about code so please help me out thank you so much!

Member Avatar
Member Avatar
+0 forum 2

I'm working in Excel to extract content of a table from a web page and populate Excel sheet cells with it. I'm trying to extract data from a table that gets loaded to a web page after show results method gets called. I have an error that says "Run-time error '424' Object required". Sub extractDataFromTable() Dim IE As Object Dim theTable As Object Dim form As Variant, button As Variant Dim doc As Object Set IE = CreateObject("InternetExplorer.Application") ' navigate to a web page With IE .Visible = True .navigate ("http://www.sizemyups.com") End With While IE.ReadyState <> 4 DoEvents Wend Set …

Member Avatar
Member Avatar
+0 forum 9

Hello , How can i run a php script using vba macro ?

Member Avatar
Member Avatar
+0 forum 1

Good morning, I have 2 client applications which do the same thing. The first app which is written in VBA(MS ACCESS) and the other is ASP.Net. We can have multiple items for a client so we use a transaction id. When the access application starts a new transaction the app gets a new transaction id and increments by 1 as follows. If VH_TRANSACTION = 0 Then ' New voucher get next transaction number With rst1 .Open "SELECT CONF_TRANSACTION FROM tblConfiguration WHERE CONF_CO_ID = " & gblUserInfo.AgencyCountry, CurrentProject.Connection, adOpenDynamic, adLockOptimistic !CONF_TRANSACTION = Nz(!CONF_TRANSACTION) + 1 gblTRANSACTION = !CONF_TRANSACTION .Update .Close End …

Member Avatar
Member Avatar
+0 forum 1

Hi, When I use the code below, the data is written to the detail section, but only shows in the design mode. How do I get the data to display on the report? Dim stDocName As String Dim db As Database Dim rs As Recordset Dim rs2 As Recordset Dim sSQL As String Dim fld As DAO.Field ' recordset field Dim txtNew As Access.TextBox ' textbox control Dim rpt As Report ' hold report object Dim lngTop As Long ' holds top value of control position Dim lngLeft As Long ' holds left value of controls position Dim location As …

Member Avatar
+0 forum 0

Hello! I've been debugging this VBA program that computes the root of an equation using Newton Raphson method and with the use of the UserForm. The user will type the equation, the initial guess and the number of iterations. I was able to search on automatically differentiating the equation unlike when the user still has to type in the derivation of the equation. The next problem I encountered was the exponential function. I would like the program to evaluate the equation whether it is simple polynomial or exponential function. I'd like my program to be flexible in either of the …

Member Avatar
+0 forum 0

Hi group, I'm trying to insert both a copied range (from and Excel file) AND a message (text) into the body of an Outlook email. I've perfected the code to insert the range, but I've not figured out how to get the message to go along with it. I hope you can help. Here's my code I've written: Sub Mail_Selection_Range_Outlook_Body() Dim rng As Range Dim OutApp As Object Dim OutMail As Object Set rng = Nothing ' Only send the visible cells in the selection. Set rng = Sheets("Listing").Range("A1:R" & lEndRow).SpecialCells(xlCellTypeVisible) If rng Is Nothing Then MsgBox "The selection is …

Member Avatar
Member Avatar
+0 forum 1

Hello DaniWeb Users/Programmers, I don't know if I post this on the right thread but I already post in Linux and Unix Thread but the cause I try ask in here is because it is programming related. I am a window user but trying to use linux for some purpose. In Microsoft Excel we can manipulate macros, functions, VBA,,.. etc.. So I was trying to do it in LibreOffice the LibreOffice Basic I have a hard time to understand things like it can create button but unfortunately I can't or I don't know how I can add code for this …

Member Avatar
Member Avatar
+0 forum 3

I was wondering if anyone could help me out with a problem I've had for a few days. This is a code snippet of a program I'm writing to move and delete email attachments from one or more selected emails. Everything works great except the program won't edit the body of the emails as written. When I interrogated in the editor, I found that the MailItems are empty upon initialization and after passed to the sub routine. Any idea why an email I know has text comes up with no body or HTMLBody in Outlook VBA? Thanks in advance. Public …

Member Avatar
Member Avatar
+0 forum 1

I am desgining a userform in ArcMap, but I don't know how to sum up numeric values in a textbox (txtBox1) in another textox (txtBox2). Can anybody provide me with a vba code for that!

Member Avatar
Member Avatar
+0 forum 16

Group, In VB.net, I use the following to return the actual name of a folder where data is kept. Is there an equivalent in VBA? I sure hope so. It would solve some problems for me. foldernameGD = CStr(getFolderNameGD("O:\Revenue Management\Centralized Revenue Management Service\CRMS Hotels", propertyNo2 & "*")) In advance, thanks for your help. Don

Member Avatar
Member Avatar
+0 forum 2

Group, In VB.net, I use the following to return the actual name of a folder where data is kept. Is there an equivalent in VBA? I sure hope so. It would solve some problems for me. foldernameGD = CStr(getFolderNameGD("O:\Revenue Management\Centralized Revenue Management Service\CRMS Hotels", propertyNo2 & "*")) In advance, thanks for your help. Don

Member Avatar
Member Avatar
+0 forum 1

Hi Group, I've recreated a spreadsheet that has multiple macro's behind it. One of these macro's opens and existing file, copies the data in it and then pastes it into the original workbook (where the macro's originate) and then closes the existing file. After the copy and paste is done, this original worksheet (for some unknown reason) is being saved as a new file (that name is "89.123456"). For the life of me, I can't figure out why. Here's the code that runs this: Option Explicit Dim strategyName As String Dim docName As String Dim priceOptName As String Dim folderName …

Member Avatar
Member Avatar
+0 forum 5

This snippet demonstrates how you can add VBA code to an Excel file at run time. **Prerequisites** In this snippet I am using Microsoft Excel 2013 with the Microsoft Excel 15.0 object library. Before you can use this code, you will have to change a setting within Microsoft Excel to authorise the use of the VBA Project Object Model from external programs. This is a security feature to protect end users from malicious programs and is disabled by default. If you do not enable this feature then the code below will result in an exception stating "Programmatic access to Visual …

Member Avatar
+0 forum 0

Hi Group, I've written a macro to save a copy of the spreadsheet at the end of each day. I tried to test it as a shared file and learned the macro wouldn't work. Is this normal for a shared document? If so, is there a way around this? How can I do this? In advance, thanks for your help. Don

Member Avatar
Member Avatar
+0 forum 7

I need to identify how the code identifies that a file is at the "eof" (end of file). Here's why: On Monday's, I'm having to combine text files created over the weekend that will eventually be read and pulled into an Excel spreadsheet (generally there are three files). Using VB.net, I'm stripping the blank lines and the words "End of Report" from the end of the first two files before merging these together. The third file gets merged as is with no changes. When I open the merged file (using Excel and VBA) to be read, I'm getting a error …

Member Avatar
Member Avatar
+0 forum 3

Hi group, I've written some VBA code behind an Excel spreadsheet to check to see if another workbook is open. If it isn't open, I'm having the code open it for me. This works fine the first time the macro runs. However this same spreadsheet has a cell where a property number is changed. When this is done and it is time to run the macro for the second time, the second worbook never opens and I go into some kind of endless loop. Can someone suggest why this may be happening? Here's the code I'm running to check to …

Member Avatar
Member Avatar
+0 forum 2

Hello Group, I'm trying to convert some VBA code into VB.net. Here is that VBA code: Open filePath For Input As #1 ' filePath = the text file I need to read Do Until textRowNo = 8 'discard these first 7 rows... Line Input #1, LineFromFile 'this is the row counter textRowNo = (textRowNo + 1) Loop Ultimately I need to throw out the first seven rows of the text file. But is there a VB.net equivalent to `Open filePath For Input As #1`? After this is done, I want to continue and begin at line 8 and do the …

Member Avatar
Member Avatar
+0 forum 8

I'm trying to write code in VBA in Excel that opens a desginated directory, finds all xls and xlsx files and then converts them to csv. I found two sets of code that do one or the other perfectly, but I can't make it work. I'm sure I'm just missing one step but the more I tweak the code the less it works: Sub select_rows() strPath = "C:\temp\pydev" Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True objExcel.DisplayAlerts = False Set objFso = CreateObject("Scripting.FileSystemObject") Set objFolder = objFso.GetFolder(strPath) For Each objFile In objFolder.Files If (objFso.GetExtensionName(objFile.Path) = "xls" Or objFso.GetExtensionName(objFile.Path) = "xlsx") Then …

Member Avatar
Member Avatar
+0 forum 30

Hello everyone! Is there a way in VBA to find a file name that has an unknown portion to it? Let me explain: Our computer system is UNIX based. It is creating a text file for us that uses the date, the hour, minutes and seconds that the file was created as its file name. This file name looks exactly like this: 20141210.104056 Finding the date isn't an issue. The unknown part is the date and time the file was created as the "file extension" (.104056) is the time stamp. That is the variable that I need to access. Is …

Member Avatar
Member Avatar
+0 forum 6

Think that macro viruses written in VBA (Visual Basic for Applications) are just something that people using the Internet a couple of decades ago had to worry about? Think again. Word macro attacks never went away, they just went into decline. New evidence suggests they could be making something of a comeback though. Coupled with research showing how non-English speaking recipients are being targeted by phishers using this technique, it makes for worrying reading some 15 years after [Melissa](http://en.wikipedia.org/wiki/Melissa_%28computer_virus%29) struck fear into the email using world. Whenever I hear non-English and phishing uttered in the same breath, I tend to …

Member Avatar
Member Avatar
+1 forum 2

Group, I'm trying to improve a macro in an EXCEL spreadsheet. The spreadsheet has multiple tabs (sheets), some of which have grouped rows in them. My "cleanup" routine needs to check to see if these grouped rows exist. Is there some code that does this (hopefully boolean)? If it helps, I'm using the following code to group: Rows(begRow & ":" & endRow).Select Selection.Rows.Group However I only want to ungroup these sheets if grouping exists on the page anywhere. Thoughts? Thanks for your help. Don

Member Avatar
Member Avatar
+0 forum 1

Group, I've created a large spreadsheet with a fair amount of code behide it. Historically it has run well and with no issues. However it has started giving me a "Run-time error '9': Subscript out of range" error. I have no idea what is causing it. It is stoping at the beginning of a new sub. The code says: Windows("All Same Store Rate Plan Production.xlsx").Activate 'failure is here sheetNo1 = ActiveWorkbook.Worksheets.Count I can promise, the spreadsheet it is referring to is open. It is named correctly. Can anyone offer some ideas as to why this error is coming up? In …

Member Avatar
Member Avatar
+0 forum 7

Hello Group, I'm writing a macro to match dates from one spreadsheet to another. Specificially, SpreadsheetA has the date listed as text. I want to match that date to a range of dates in a column to find the row the matching date is on. I have some things that I need to be prepared to overcome: SpreadsheetA has the date I'm looking for and it's formatted as "20-SEP-2014". SpreadsheetB has all of the dates in my range formatted as "20-Sep". I've taken account for this in my code: strngDate = Right(findDate, 11) strngDate = Left(strngDate, 6) rowA = Columns("A:A").Find(What:=strngDate, …

Member Avatar
Member Avatar
+0 forum 2

I need to dynamically group rows together in an EXCEL worksheet. The obvious choice to do this will be VBA. I hope you can help. My spreadsheet has 18 columns and (up to) 5,000 rows of data. I've written the following code which works "OK" however it fails to group the last group and those few rows afterwards. Private Sub Worksheet_Activate() Dim myRange As Range Dim rowCount As Integer, currentRow As Integer Dim firstBlankRow As Integer, lastBlankRow As Integer Dim currentRowValue As String Dim neighborColumnValue As String 'select range based on given named range Set myRange = Range("B16:B5000") rowCount = …

Member Avatar
Member Avatar
+0 forum 4

Hello, The code below works almost perfectly except for two flaws: 1. It provides the full name of the file (workbook.xls) instead of just "workbook" 2. If there is more than 1 worksheet then the loop appends the previous worksheet to the filename. For example, Workbook1 has 1 worksheet Workbook2 has 2 worksheets Workbook3 has 1 worksheet Result is Workbook1.xls-Sheet1.csv Workbook2.xls-Sheet1.csv Workbook2.xls-Sheet1-Sheet2.csv Workbook3.xls-Sheet1.csv Desired outcome: Workbook1-Sheet1.csv Workbook2-Sheet1.csv Workbook2-Sheet2.csv Workbook3-Sheet1.csv I can probably figure out how to strip off the ".xls" from the filename but I don't get why the loop appends the current worksheet name to the previous one. Sub …

Member Avatar
Member Avatar
+0 forum 1

I am trying to insert records in a SQL table from Excel sheet with VBA code. Data contains of a range with all the rows to be inserted. I am using below code for the same. Insert INTO [odbc;Driver={SQL Server};Server=myserver;Database=mydb;Uid=abc;PWD=abc].DPR Select * FROM [TempRange] I am getting error as above. Various columns in data range is exactly as per the sql table col names. I am using Excel 2007 with SQL2012. Kindly help to resolve this error. Regards, Madiya

Member Avatar
Member Avatar
+0 forum 6

The End.