I have a userform with a numerous textboxes, which I have labeled with similar text and a unique number at the end (num1_txt, num2_txt, num3_txt, etc.). I am trying to create a for loop that sequentially references the numbers of the text boxes and pulls the user-entered value in the text boxes into an Excel document.
Here is the code I have so far...
i = 1
For i = 1 To 18
Dim cyltrack As String
cyltrack = "Me.cyltrack" & i & "_txt.Text"
If Me.cyltrack.Value = "" Then
Cells((cellcount + i), 13).Value = "*"
Cells((cellcount + i), 13).Value = cyltrack
I am running into problems in trying to convert the string variable, cyltrack, into hard code that I could insert into Me.cyltrack.Value.
I have a worksheet that I need to be able to easily copy and paste the formula/formatting from the row above, but not the Values entered, (if any). I am using columns A to DG.
I just really need to be able to copy all the formula in these cells down - nothing exciting or fancy.
I've tried formatting as a table as per some searches and that was difficult! My column headings changed, and when I inserted a row, two of the formula's wouldn't copy down - plus the shading and borders went wonky in places.
I have no experience programming although I'm vaguely familiar with Excel offering ways to automate many processes. My current situation involves me having to insert a new line whenever a there's a change of term in a row after a long sequence of repeated terms in a specific column. So, for instance, we have something like this:
How can I get at parameters passed on a command line to Excel 2007?
For example invoking Excel from Vista's Run command with: "C:ProgramDataMicrosoftWindowsStart MenuProgramsMicrosoft OfficeMicrosoft Office Excel 2007" "C:GZNORPWeather StationParamTest1.xlsm" /e/abc/def
Should reveal the parameters "abc" and "def". But this does not happen!
Supposedly, the API function GetCommandLine does this, but I cannot seem to get it to work. Here's a sample of what I've been trying:
I've got an Excel file that uses 7-zip. It can execute a command line that will use 7-zip to go to a folder and zip each of the folder's files into its own zip file, placing the zips in a single, specified destination folder. I can specify whether to look in the source folder, or to also look in all of the source folder's subdirectories.
Question is, how do I tell 7-zip to just zip ONE file, and how do I tell 7-zip to zip a SPECIFIC LIST of files that I name (instead of looking through a whole folder)? how to use command line...
Code: Sub a_zip_with_sub_directories() Shell "cmd /c for /r ""C:Users aiDocumentsmonthly reportsFinal Copies of Monthly Reports"" %i in (*.*) do ""%ProgramFiles%7-Zip7za.exe"" a -tzip ""C:DATA aiipped\%~ni"" ""%i""" End Sub Sub a_zip_no_sub_directories() Shell "cmd /c for %i in (""C:Users aiDocumentsmonthly reportsFinal Copies of Monthly Reports*.*"") do ""%ProgramFiles%7-Zip7za.exe"" a -tzip ""C:DATA aiipped\%~ni"" ""%i""" End Sub
One has around 129 lines for the first years 2006 in sheet1. The other links to the first 129 rows. Then I've linked the top 129 in sheet2 130 down for 2007 and so on for 5 years.
How would I add a line in Sheet1 then would insert 5 lines in sheet2 keeping the same order.
Sheet1 Name Rev Year John £120 2006 Row 5 Jack £150 2006 Row 6
Sheet2 (linked) Name Rev Year John £120 2006 Row 5 Jack £150 2006 Row 6 John £130 2007 Row 134 Jack £160 2007 Row 135 John £140 2008 Row 263 Jack £160 2008 Row 264 John £150 2009 Row 392 Jack £170 2009 Row 393 John £155 2010 Row 521 Jack £180 2010 Row 522
I have created an AddIn for a project I'm working on using the 'Open' command in Excel Vb. While this worked perfectly for the file I was testing it on (1,740,754 bytes) it doesn't work on a new file (121,445,125 bytes).
On testing the code, one line at a time, it gets stuck on
Line Input #1, DataLine
The files only contain one line so I suspect there is too much data for the command to handle.
I am trying to develope a "goto" page macro where the page value maybe 1,34,7A, 256C etc. I am not clear on how an inputbox value can be compared to a string variable or a numeric variable at the same time. This is what I have done, but when the texboxvalue is "7A" it doesn't work.
I'm looking to have an excell file shared on a windows network to a simple LAN (samba sharing), and then for a user to be able to click on a HTML link that will launch that excell pile, and to have it populate specific and predeterminined cells with information that will be handed to it by the HTML link from the website.
Think of a CRM web app that href is a link like: "LAN1Filesexcellbook01.xls?Mrs%20Wendy%20Jones?4%20Skin%20Street"
From something like that I would like to launch excell and have Mrs Jones' details populate into the predefined excell sheet. The HTML website can dynamically populate a HTML link depending on the customer being viewed.
So I'd like to know how two things
1) How to launch a network file in this way, while correctly handing it parameters or switched that it will be able to later: 2) Collect that information and distribute it into the cells I choose in VBA.
I'm familiar with Visual Basic .Net primarily, and have a small amount of VBA experience.
We would like to continue to use Google chrome if possible...
Say you define a public range variable called Inputworksheet and you set it to refer to the worksheet called Inputworksheet. You have a separate string variable with the value Inputworksheet. How do you get this string variable value to call/control the range variable Inputworksheet?
I am getting an excel worksheet value from a lookup function that corresponds to the name of a VBA range variable. Once I have this worksheet value, I would like to use the range variable that has the same name as the worksheet value.
I've recently created a macro which takes a .csv file and scrubs the data and dresses it up for a report. I've finally got it running without any problems and have added it individually to 5 different user accounts on my network as an add-in, but need a way to share it across a computer network without allowing others to edit the file.
The report is generated multiple times a day by the different users, none of whom are very computer literate (not that I am much better, myself), and the macro over-writes the old file each time. I've read that it's possible to simply create a shortcut to the file that automatically opens the spreadsheet in read-only format, which would be perfect for what I'm trying to do, but I haven't been able to get it to work so far.
On my computer at work (Windows 7) the shortcut simply opens the spreadsheet so that anyone can edit it, instead of as a read-only file. On my computer at home (I'm trying to experiment) (windows 8.1) it won't even let me save the shortcut, saying I need to provide administrator permission & then cutting to a window that says "access denied".
I won't have the pathway for the actual file I'm trying to create a shortcut for until tomorrow when I get back to work, but I've formatted it essentially the same, directing to the excel.exe file, running the switch "/R", and then directing it to the actual file location.
The ultimate goal is to have multiple people be able to view the file without locking out those who need to update it.
I have a data set which is structured such that there are variable numbers of products (column A) from 1 - 48 and these repeat multiple times for each "Name" held in column B. I have attached an example of this which uses a data set with 7 entries reapeating 7 times.
I need excel to insert 2 formula for me multiple times which needs to varry according as follows
1. Calculate the average value of data in Column C - G for n cells starting at a specific cell (C2), I have inserted an example of this and highlighted it in yellow. This then needs to repeat down column C several times, the number of times this will repeat depends upon the number of different names held in column B. But I have this calculated already and stored in a cell im my main document.
2. Calculate the variance of each value in the x cells above from the average calculated in point 1 above. I have highlighted this also in yellow.
I'm using a userform to create a new sheet. The form already creates the sheet and names it what was typed into the userform. Now I want it to place that variable in a cell along with a string. the following code will place the variable from the form (tbname) into cell b5.
I'm analysing some data sets with variable content, and need to insert blank rows every so often to provide space to do some analysis. The problem I have is that the position of the blank rows change according to the data set, I have been able to calculate how often the row needs to be inserted using VBA as part of my import routine and saved this value to a cell, but I cant figure out how to write the VBA which will insert rows using this value and stop at the end of the data set.
In the attached example I need to insert a row each time the data in column 2 (name) changes, this is the value I have calculated which in this example is 7. So in this attached file I need to insert a row in row 2, row 9 and so on etc. But this is what changes depending upon the "Product" held in colum 1.
I'm trying to create a macro that will open automatically generated report outputs and manipulate the data.
The macro will run from it's own workbook (Report Macro.xls), sheets / cells within this workbook are available as 'helpers'.
So far what I have working ok is;
Via a browse dialogs in a userform in Report Macro.xls I select 5 different report outputs. I'm storing the full filename & path in Sheet Data, Cells B1:B6 (B1 being the filename & path to the macro file). In column C I have just the filename
The first file is opened and manipulated as required. The next thing I need to do with it is to open the second file (filename / path in B3) and put a Vlookup in cell 02 of the first file which will look for data in the second (the second file will only ever have a single sheet).
As a formula I'd be using
Code: =VLOOKUP(A2,'Email 22FEB12.XLS'!$B$7:$C$13120,2,FALSE) In VBA if I use;
Code: ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-14],'Email 22FEB12.XLS'!R7C2:R13120C3,2,FALSE)" It works great. However, the second filename will change and I need to take it from the macro file, sheet 'Data', cell 'C3'.
How can I use the contents of sheet Data, cell C3 in the VBA code above instead of the filename being hard-coded?
If I want to specify a range (such as (A1:A10), but I don't know the 2nd part of the range (the A10), but I do have that value in a variable, how do I specify that? For instance, if the integer variable named 'r' has the value of '10', how would I specify (A1:Ar), which I want to translate to (A1:A10)?
I have a list of names in the A column of the sheet. I wish to use the input string, a new name, of a vba box to insert into the column of existing names in alphabetical order by inserting an entire row, which I suspect will be the case anyway. Also 'Return' key doesn't seem to be inserting a CR on the page that I typed this request upon.
get the first line from a string which has several lines of text in it. I believe the Ubound function in VBA should do it, but I can't seem to get the syntax right. The lines are seperated by a return character.