I'm try to get a macro to do a 5 Colour Conditional format. I've searched the previous questions as recommended, and found code that I think will do the job. I've tried to modify it to my own specs, but I can't get it to do want I want. Basically I need it to colour code the cells based on the ball number within them. As I can't get the code to work, I don't know if the colour values are correct? Also given that cells are white by default, balls 1 - 9 don't need to be part of the code do they? I've attached a small example of what I've managed so far, with the macro code enbedded. Also what's the correct way of cpoying & pasting macro code from one spreadshhet to another? The simple copy and paste seems to stop the code working correctly. Any help would be greatfully received.
I am new to VBA and i need to write a VBA code that should transfer or export any selected thing (whether it may be table, cell or chart ) in Excel Sheet to Powerpoint presentation. My excel Sheet consist of a table and a chart generated from this table.
I am trying to accomplish is to display a dropdown or combobox with a list of choices. I want the backcolor to be shaded light green to match instructional text that appears in the cell above. That I have working with the selections appearing. Once a choice is made I want a separate procedure to run that will somehow know which choice was made.
I can't put the code within the module for this particular sheet as it is dynamically recreated each time the data is refreshed and the code will disappear. This may seem to be an odd practice but this is how 25+ workbooks are coded within this system for my employer's customer and it is a required practice.
VB: 'enables user to click [U]highlight and select[/U] an item in ListBox1 and ListBox2 item (same row in index) is also [U]highlighted[/U] (highlighted only not selected) Private Sub ListBox1_Click() ListBox2.ListIndex = ListBox1.ListIndex End Sub
Question: Is it also possible to enable a user to click to select an item in ListBox1 and ListBox2 item is also selected simultaneously (same row in index). Is there excel vb code to do this?
I think the code may be along the lines of the ListBox SelectedIndex property. What would be the Excel VB code equivilant for the ListBox SelectedIndex property, if so?
I have an excel form with a command (submit) button that opens up Outlook when clicked. I am looking for a way to have this submit button disappear when the user selects a specific item in a drop down list to make sure they do not email the form when it is used for a promotion (Promotion would be selected in the drop down).
I am getting close to finishing the drop down menu capability when filling in column L in tab Transactions. However, there is a snag. When I enter part of account say "fin" (the important part here is that the part of the word should not be the beginning of the account name) - then I select an account from the menu - but it does not stay in the cell if the part of the name is the beginning of the account name - all is fine.
I m creating a sheet in excel where I need to do some conditional formatting but need more than 3 rules so i'm guessing i'll need to use some vb code.
Basically I have a range of cells say from c12 to ag15 These cells all have formulas in linking to other cells in other sheets.
Tha values that will be in them are as follows: s, h, hd,ooo,z and maybe 1 or 2 more will be added later. I need the cells background and text colour both to change to a colour depending on the value in the cell.
eg. cell value = s then background and text colour both to be yellow.
I found code that I would like to use conditional formatting code as shown here. Here is the code just in case:
Private Sub Worksheet_Change(ByVal Target As Range) Dim icolor As Integer
If Not Intersect(Target, Range("A1:A10")) Is Nothing Then Select Case Target Case 1 To 5 icolor = 6 Case 6 To 10 icolor = 12 Case 11 To 15 icolor = 7 Case 16 To 20
how can I get this code to work across the entire workbook and not just for the specific worksheet? I tried pasting the code into the This Workbook under VBA Project and changing the Private to Public but no go.
I used Scheduled Task to set up my spreadsheet to open daily. I have the code with assistance to pull out the due date items and place them into an email.
I have come across XLSTART/AUTOEXEC/ACTIVATE...ETC... But cannot figure out the code that will automatically "enabling macro" once Scheduled Task opens the spreadsheet?
Then once the macro runs, the email with the due dates, how can this auto send without user interaction? (currently I would have to hit send)
I am trying to make the process totally automated to open the spreadsheet at a certain time, send the email with due dates and close the spreadsheet.
Following code in ThisWorkbook--
Private Sub Workbook_Open() Check_Date_Send_Mail End Sub Code in Module1--
Option Explicit Sub Check_Date_Send_Mail() Dim wbBook As Workbook Dim wsSheet As Worksheet Dim rnDate As Range, rnValue As Range Dim stAddress As String, stMsg As String Dim stRecipient As String, stSubject As String Dim stPost As String Set wbBook = ThisWorkbook Set wsSheet = wbBook.Worksheets("Sheet1") With wsSheet Set rnDate = .Range("d2:t23") End With
What is the code for getting Excel to send an email once I close a line item? I got some code from another post but can't get it to work for me. My current spreadsheet is a list of outstanding problems. Once the issue is "Closed" (Dropdown in column U), I would like Excel to email a recipient who's address is in Column K. The issue is in the code - If c = "Closed" Then
Sub Closed() 'You need to Reference Outlook 'Goto Tools>References and select Microsoft Outlook Libary 9.0 (or your version) Dim olApp As Outlook.Application
I am copying and pasting from two different " timesheet" spreadsheets into a list. One of the timesheets has blank rows. I am attempting to sort the blank rows to the bottom after I paste the data, but every time I do, it either replaces the top row with "true" or deletes the headers,
Sub SortBlankRows() Dim rngCurrent As Range Dim c As Range Dim inUsedRow As Integer Set rngCurrent = Workbooks("Payroll Summary.xls").Worksheets(1).Range("A1:J1") inUsedRow = Workbooks("Payroll Summary.xls").Worksheets(1).Range("D65536").End(xlUp).Row rngCurrent = rngCurrent.Resize(inUsedRow) rngCurrent.Select Selection.Sort Key1:=Range("D1"), Order1:=xlAscending, Key2:=Range("F1") _ , Order2:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:= _ False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _ :=xlSortNormal End Sub
I have a list of 20 cities in K1:20 and they can be selected from a drop down menu in column A2:A22. I want then to randomly pick 6 out of 20 and these 6 cities must to appear in a line A1, B1, C1, D1, F1, and G1
On cell A1 I have used the
IF ( A2=K1,K1, IF(A3=K1,K1...................A22=K1,K1,IF(A2=K2,K2......A22=K3,K3)
It seem to be an endless formula is there another way to make it easy ???
I am struggling with work-schedule worksheet and I want to do this:
In my attached sample worksheet are cells coresponding to a day of the month (monday to sunday, and so on...), and cell for job positions. Each day I must assign 5 employees to a different job position (job positions are on drop down lists).
When I select first job (on specific day), I want a pop-up window where would show what job I have allready selected and what job hasn't been selected so far.
How can I do that, is It possible in VBA coding, maybe with Listbox or CheckedListbox.
I am a softball coach and I want to create a fielding roster for my team. I have all the players names in column A (A4:A14). I have positions listed in column L (L4:L15) as follows: P, C, 1B, 2B, SS, 3B, LF, LC, CF, RC, RF, X. Cell range B4:H14 (7 innings) is where I need to have drop downs, but once I select a certain positions for one player in inning 1, for ex., I want it to not be available for the next player in the same inning.
how I can have the selected item in a dropdownlist also to be shown in another cell? Typing the cell number of the dropdownlist in another cell (f.e. ="dropdownlist cell number)" doesn't seem to do it.
I've created and coded a vba userform that creates purchase orders for my projects. The user begins by selecting the project code from the combobox (the project code is a unique identifier of each project). Once the purchase order is created, the information is logged in a separate sheet called "POLog" and the userform is cleared. The project code is saved in the first column of the "POLog".
My problem is that when I have more than one purchase order to create for the same project (sometimes I have 20 or 30), the combobox starts out empty and I have to manually select the project code from the combobox. Is there a way to allow the userform to recall the last project code that was used? Maybe recalling it from the last row in the "POLog" sheet?
It seems that when reloading a listbox (in my case in ppt, but triggered from vba in excel) the ppt application (office 2010) was not highlighting the selected row in the listbox, and was infact also losing the selected row information when the item lost focus.
indication in excel that new data is to be displayed triggers macro in ppt to fetch data and update:- 1. select the userform and listbox 2. fetch the data from excel worksheet range into a local array 3. save locally the current selected index in the listbox 4. reload the data into the listbox and adjust column widths 5. relocate the old selected item, and set the new selected index
Summary of key Code lines which did not work:
Code which worked fine:
So in summary, if you get problems with listbox selected items not being highlighted, double check you are not re-defining column widths after loading the data into the list.....
I have a userform that search for a value in column A, it displays the results in the listbox. Example: Search for value "111" and it brings me back the following results back in the listbox "111 David 35". So this means 3 columns matching data is returned.
I want the following to happen if I double click on the item in the listbox it needs to update the value selected in the worksheet eg. strikethrough the row on the sheet to show item has been selected/done.
I plan to place a drop down list (combo box) in a WS where I upon selection of one item from that list will move me to the place in the same WS where the item selected is to be found. Hyperlinks are a theory, but the WS is protected and will stay protected. A drop down is preferred.
I haven't worked with this topics for quite some time and might have forgotten some basics.