I'm having trouble creating a macro that will look at a single URL, and based on what text is in a cell, replace that name and put it into a specific location in the URL. Then the URL will open and the rest is a macro I've written already. This will then be done as many times as need as long as there is text in the column.
So I'm looking to declare the text in these cells as different variables, then have something call these variables into a specific location in a URL, then have that URL (which is a worksheet location) open up. This is because I have many URL worksheet locations on an external website, I'd like for my macro to look at the cells in column A, check "A2" and whatever that name is, and have it placed into the URL. I assume some type of loop would be useful, since I do not want them to open up all at once, but one by one based on the text or variable in the column. Then the URL will open.
Then I can run my macro code which will include copying and pasting, closing and saving. Then go the next cell, check "A3" then repeat the process. The URL for all the worksheets are all the same, except for one specifc name, which is what im looking to replace one by one.
Using Excel 2007, I'm trying to figure out (and not succeeding!) on how to declare worksheet and range - in order to:
input a formula to cell xfd1, then copy down to xfd2:xfd100 - and here's what I've been playing about with
Code: Sub filldownxfd() Dim src As Range, out As Range, wks As Worksheet Dim sRangeName As String Workbooks.Item(1).Sheets.Item ("Sheet1") Dim example As Range Set example = Range("xfd2:xfd100")
Can anyone tell me how to have a variable which can store leading zero's. I am using this variable and part of a string and want it to be able to store and calculate numbers such as 0005 at the moment if such a number is entered it sees it as 5. At the moment I have declared the variables as integers but clearly this is incorrect.
I am trying to make sense of quite an elaborate macro built by someone else. This has the following line of code
Code:
Public Sub readOperation(rowNumber As Integer) Dim rowOff As Integer rowOff = rowNumber - 1 'other arguments and conditions End Sub
What I am buggered about is that I cannot see the the variable rowNumber being declared anywhere but it seems to have a value of 1. I should mention that Operation is a class and I am very new to classes.
Option Explicit Public intLRow As Integer Public strNetDrive As String Public strDocName As String Const strNetDrive = "\DriveDocuments" Then i have this as a macro to test it:
Sub test() Range("A1").Formula = strNetDrive End Sub When i run the macro i get this error:
I have a worksheet that has 2 sheets. I want to declare a variable that can be accessed for reading and/or overwriting by both of those sheets. Where do I declare it and how do I access it from Sheet1 for example?
Is it possible to declare n variable names dynamically in a macro? For example: Cell A2 in Sheet1 contains the number of variables to be considered in the macro (n). I would like all the variables to take names in the macro from node1 to noden using the dim statement. I tried running a for loop:
Prior to declaring a variable i used this code and it worked:
Sheets("442000ON-1+6").Range("C7").formula = "my formula" range(C7).select Selection.AutoFill Destination:=Range("C7:N7"), Type:=xlFillDefault
Than i declared a variable b/c i have a number of formulas i need to use but still needed it to fill the formula in a series after the formula ran. I started getting an error.
Set SourceRange = Worksheets("442000ON-1+6").Range("C7") Set fillRange = Worksheets("442000ON-1+6").Range("C7:N7") SourceRange.AutoFill Destination:=fillRange
i'm trying to develop an array that is populated when a userform is activated. The userform has a command button that when pressed, will cross check the information filled out in the userform with the entries in the array. If there are no matches then the array is ReDim and the new information is added to the array. Once all the entries have been made. The array is then transposed to a sheet titled "Database". My problem is that vba is not allowing me declare a public array.Below is the first part of the code. Which is when the userform is activated.
Private Sub UserForm_Activate() With Sheets("Resources") cbZIP.List = .Range("A2", .Range("A" & Rows.Count).End(xlUp)).Value cbBED.List = .Range("B2", .Range("B" & Rows.Count).End(xlUp)).Value cbBATH.List = .Range("C2", .Range("C" & Rows.Count).End(xlUp)).Value cbSTABRV.List = .Range("G2", .Range("G" & Rows.Count).End(xlUp)).Value End With
I am trying to compare two workbooks and am running into the problem that since I declared my two workbooks, I am limited in the methods that I can use. Here is all of the code so far.
Option Explicit Sub UpdateMasterFile() Dim wbMaster As Workbooks Dim wbEmailed As Workbooks Dim wsPC As Worksheet Dim Master As Long Dim Emailed As Long Dim intMaster As Integer Dim intEmailed As Integer Set wbMaster = Workbooks("Master Info.xls").Sheets("PlantsCom") Set wbEmailed = Workbooks("EmailedData.xls").Sheets("NewInfo") Master = Workbooks("Master Info.xls").Sheets("PlantsCom"). Range("a65536").End(xlUp).Row Emailed = Workbooks("EmailedData.xls").Sheets("NewInfo").Range("a65536").End(xlUp).Row..............
Users select a row number which then opens up a Userform. Comboboxes and Textboxes on this Userform are then populated with coloumn values (dependant on the row initially selected). If the row number was the same each time I could accomplish this by the following.
Private Sub TextBox1_Enter() TextBox1.Value = Range("a1") End Sub
but as its a variable I'm trying the following (which I think should work)
Private Sub TextBox1_Enter() TextBox1.Value = Range("a" & edi & "") End Sub
I think I need to declare the variable 'edi' as Public. If so where should this be? I've tried 'Genereal Declaration'
Can a Function give two or more output variables. e.g.
Sub a() x = 5 result = Y(x) End Sub
Function Y (x As Integer) As Integer Dim B B = ... * x Y = ... * B
this will give back Y as a result. But if I want to get 2 or more output variables (let's say I need to get also B into sub) from one function, how should I do that? I need this because function works with large matrix and I want to extract some values appeared in between.
I'm trying to loop through a range in excel from access, checking where the titles (in Excel row 1) match with the fields (in a recordset in Access that is passed to the function) - and where they do, I want to dimension a variable to hold the column number - I'm not sure it's possible, but I'd be interested to know either way. The line I'm asking about is at the bottom of the code - the rest of the code is just to give context...
Sub ImportGeneric(rsImported As ADODB.Recordset, rsConfirmed As ADODB.Recordset) Dim fd As FileDialog Dim xl As New Excel.Application Dim wb As Excel.Workbook Dim ws As Worksheet Dim iFilePicked As Integer Dim strFilePath As String fd.Filters.clear fd.Filters.Add "Excel files", "*.xls" fd.ButtonName = "Select" iFilePicked = fd.Show If iFilePicked = -1 Then strFilePath = fd.SelectedItems(1) Else ..................
i have a "problem" to empty / reset my variables. I defined them as vHour1_KW2 where the "1" is from 1 to 21 and the "2" starts from 1 to 53. Now I want to erase all of this variables or to set the value of them to "0". At moment I use following
So, my question is, i tried to put the (1/31/2001) and (26/11/2007) which is in the above URL which is separated in variables and the URL remain the same
I am trying to use COUNTIF with two critera. If this isn't possible is there any other way possible of doing this in a range of cells.
What I am trying to do is show the amount of students in a year group who spend x amount of hours on the internet and have a target grade (for example) of Lvl 4
I have been trying use a formula along the lines of =COUNTIF (Q5yr7, "0- 1Hour", Q12yr7, "4")
vlookup with 3 different variables, for example cells k4 k5 and k6 can be changed to give different variables. Is it possible to have a vlookup function in cell k9 which returns the correct % when the 3 variables are chosen. example, blue boat 48 would return %value of 21%
I am trying to count the status and type of some work so:
Column A would contain the status of the work e.g. open, in progress, closed etc. Column B would contain the department: ict, development, operations, etc.
I want to do a summary that shows: How many are in ICT are open, closed etc.
I can do a countif to get the total open, in progress etc or total number of ICT jobs but not ICT In progress.
I am trying to add an additional criteria to the following sumproduct formula. The formula below works fine to add up values that are within a date range. However, I want to add values within a specified date range as well as one additional variable. The additional variable is in column G.
I want to make an excel funktion than can distinguish between 3 variables. The three variables are the outcomes of my first function which are 0, 1 and 2 these IF functions can be seen below: =IF(B11>52;"1";"0") =IF(B12>5;"1";"0") Then when I have these results I have tried the following function: =IF(C11+C12=2;"6-12";"4-6") By using this function I get an output for 2 (true) and 0 (false), but I would also like an output for 1 (which would be 6 in my work) It looks like this: Var 1 58 1 Var 2 4 0 Suggestion 4-6
So in the above case where the sum of var1 and var2 is 1 it is only counted as false for not being 2 and therefore = 4-6 instead of what I would like it to be = 6 (for 1)
I'm trying to count cells in one column that match a variable only if it also matches a variable in another column. For example, I want to count all of the cells in column A that match "Franklin" only if column D shows "True".