My VBA is very rusty, and I can't get the following code to work. I need to workout the number of rows that contain data in a range so that I can eventually write a formula in a adjacent cell, but I keep getting errors (Type mismatch or Subscript out of range) at the first step!
Code:
Sub create_product_column()
Dim num_rows As Range ' The number of rows in the datarange
Dim my_workbook As workbook ' The name of this workbook
Dim my_worksheet As worksheet ' The name of the worksheet to work on
if a combobox in a userform can be populated by the NAMES of defined ranges in a worksheet?
ie. worksheet contains 3 NAMED arrays: W1 = $C$5:$E$6, W2 = $C$8:$E$9, W3 = $C$11:$E$12. Have the combobox in the userform actully list W1, W2, W3 so that when W2 is picked (for example), cell $C$8 will be selected.
I have a Range on one sheet formatted like this and sorted by Sup then Rep:
Rep Sup John Sally Mark Sally Joseph Sally George Betty James Betty
etc..
I have a Validation Drop Down list where a Supervisor is chosen. There's a specific range that I would like to automatically fill in with the reps assigned to the Sup. This is driving me crazy! I already know how to obtain that list as another Validation Drop Down, but not quite sure how to make those values appear in a range instead of a Validation List.
i want to write a macro which searches for data in a xl sheet.It should then format that data in a particular format.The data can be present in multiple places.For eg. formating a 5*6 matrix which starts from d4 cell and a 4*7 matrix which starts from e15 cell(please note that d4 and e15 location are not fixed).
I have a range of data in columns A2 to Mx. The length of the columns varies, and all cells are not always populated. I want to be able to select the entire range, no matter what its length, no matter how many cells are populated (as both of these will vary on each tab) However, I do not want to select A1 to M1 as this is column headers which need to be excluded from the data for compliation purposes.
How to to find a formula which will pick the highest number in a row when another row is populated. For example, in the table below row 1 has some numbers, with rows 2-5 being populated with a Y. I'd like a formula to look across the rows individually and pick the highest number in row 1 (it should equal the numbers shown in column F.) when there is a Y in row 2. Then the same again for 3.
I'm putting the finishing touches to a grade sheet for the new academic year. I have one column that calculates a grade using the OFFSET function from a given number of points. However, I only want this cell to show a grade when the nine individual unit columns have been populated. If fewer than 9 columns have been populated, the cell in question needs to be blank. I've tried using COUNTA to count the number of populated cells and then linking that cell to an =IF(Q5=9... formula, but haven't been able to crack it yet. I'm probably missing something obvious...
Im trying to create a formula that looks along a row and then where theres an entry it looks at the top row and picks the highest number. I've attached a spreadsheet showing a shrunken version of the excel file, the answer to the formulas are in column F for each row.
how to hide a value on a cell when another cell is not yet populated?
like for example:
A1 is Blank A2 has a formula of workday(A1,2) a date will appear on the A2 cell and I want not to show or be hidden the date in A2 until A1 is populated
I am now looking for a command that will return if a cell is populated. I.e. I need something that will find out which cell is the last one populated in a column (populated = contains data) and then will move 2 cells down, and then will enter some data into the following cells.
I am trying to get a cell to become a hyperlink after it has been populated.
For Example:
If cell H42 of Sheet 1 = [ X ] Then create a hyperlink to cell B2 of sheet 2.
I have been trying quite a few different things the latest I have written is the following:
Sub Macro1() Dim cell As Object Set cell = [ X ] If H42 = cell Then ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _ "Sheet2!B2", TextToDisplay:="[ X ]" End If End Sub
I am trying to write some code to choose the last "comments" entered in column 13 and then copy the data to B17 on the specified sheet below.
I get an Excel Error Excel cannot complete this task with available resources. Choose less data or close other application THEN a VB error Method'open' of object 'Workbooks' failed
Code: Dim MyMgr As String Dim whichsheet as string
I have a userform (seen below) in which the user selects any number of ZIP Codes (right - ListBox2) after selecting a county/location (left - ListBox1.)
My dilema is that I need to somehow record the selections for EACH county/location, while making sure that when saving the selected ZIP's to the "Area Associations" sheet, I don't create duplicates. Of course any ZIP deselected needs to not be recorded to the sheet.
The "Area Associations" sheet is set up as follows: [Any given row after row 1] Column A = Area (Area is selected prior to the userform being displayed) Column B - ??? = the selected ZIP's
The selected ZIP's do NOT have to be in any specific order, because I have a routine to search through the row looking for any instance of any particular ZIP Code.
Cell AR10 is my target cell and then there are 15 other cells that populate when the correct information is put into cell AR10, but if one of the other cells does not have any information in it, it returns a "0" (zero). I am trying to get the cell to show blank as when I print I don't want a "0" (zero) in every cell that has not got any information.
2 x cells are showing telephone numbers, 1 x landline and 1 x mobile - sometimes we don't have a landline number, so I want the cell to show blank not "0" (zero)
The cell format is set to "text", but I have tried setting it to "general", "number" and finally settled on "text", but all return "0" (zero) if we don't have a number for them.
I have a sheet that shows employee absences, I require a formula that will look to see if a friday and a monday are populated and auto-populate the saturday and sunday to match the run, if the only the monday is populated then the saturday and sunday need to stay blank, if only the friday is populated then I also need the saturday and sunday to stay blank.
I have attached a sheet with the current display and the desired outcome.
I'm trying to create an accounting document, but stuck in couple fields
1) Make balance appear in column E5 only if column C5 OR D5 is polulated, so goes for the rest of the cell in that colu
2) I like to have 2 digits after the decimal but (same as above) i want it to appear ONLY if there are any decimals to that number, all those 0 become confusing.
3) I need to make it so the last calculated cell on sheet Jan of column E gets transfered auto to sheet Feb D3 of F3 so the calculations could proceed to the next month
to be able to do is have a stock control sheet that tells me how much of 1 item we have in stock which is easy, the hard part comes when this stock is sold as this stock can be sold to a number of different customers e.g.
i need a way of saying that we have 10,000 pens but if we sold 1,000 then we can click a button (macro maybe) and that will automatically see that we have 10,000 for that line and we have only sold 1,000 so we need a line inserting saying that we have 9,000 remaing and so on.... The sheet needs to record who these goes to though, that the reason i was thinking of adding a row
If this doesnt make sense then i am happy to answer your questions?
i can upload an example excel sheet if required if someone can explain how i do this?
I have 2 related columns with one to many relationship, on a tab populated with some data. On another tab I'm referencing these 2 columns. When I populate one column I would like a drop down showing all the related data from the 2nd column of the first tab in the 2nd tab. I'm unable to do a named range as my first column has spaces in its name.
I have attached a sample file. I would if possible like to have a hyperlink at the top of the sheet that when pressed would take you to the last populated cell in column G. I can do a normal hyperlinks but over time the hyperlink would take you to the wrong place as the sheet is filled in more and more. Is this possible?
I have tried to adapt various macros I have found on this forum but they on't seem to do want I ask of them I also seemed to have acquired an extra vba project (Ubitmenuo4) in the worksheet and can't get rid of it, so just ignore that
Why is it when i try adding items to my listbox it comes up with the error Permission Denied. Im using rowsource just to have a heading tho when i want to add items it come up with the error.
Note my headings are in "K2:M3" Eg. With Me.ListBox1
I have a list where the lines of data I need are not uniform in relation to the customer identifier, ideally I want to get the Lookup (or equivalent) to ignore the blank and move down the column to the next populated cell as below.
I have a worksheet where the first two cells in the header are blank but the third and last cell is not. I'm trying to find the code which would give me the last populated cell in the header.
If I have a cell "C8" default value is "choose" and it is a drop list of other values. I want to validate if "C8" is populated with a value other than "choose" that the user populates the SOME of other cells in the row like D8 or F8? I would like to alert something that the cell needs to be populated.