Excel VBA - Cursor Movements Based On Conditions
Apr 20, 2014
After I did the conditional formatting, I wanted the cursor to skip the colored cells. I used this code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Moves the active cell to the first column when enter button is pressed
If Target.Cells.Count > 1 Then Exit Sub
Select Case Target.Column
Case 12
Cells(Target.Row, Target.Column + 2).Select
Case Else
Exit Sub
End Select
But to no avail it applies to the whole sheet and I did this for "Condominium". How do I make it as a condition when I choose any property type? and then it'll go one step down to column A when the last row is typed/filled in?
For example, if I choose Condominium as my property type, Land Size (i.e. column M) is colored so the cursor will go from column L to Column N. If I choose Land as my property type, Furnished to Floors total (i.e. columns I to L) Bedrooms to Rooms Total (i.e Columns O to Q) Indoor Features to Other Features (i.e. Columns T to W) are colored so the cursor will go from column H to M then Column N to R and then Column S and then move one step below to column A when entered. and so on.
sample sheet.png
View 3 Replies
ADVERTISEMENT
Sep 5, 2009
I have a workbook that contains spreadsheets that serve as input sheets to generate reports (other spreadsheeets within the workbook). I did not create user forms as I find them cumbersome to do so. Instead I formatted the input sheets to be extremely user friendly. I protected the sheets so that user can only access the unlocked cells that require inputs.
Question:
Is it possible to control the movement of the cursor by both tab and enter like is done in the user forms. The input cells are spread out in various locations on the spreadsheet - therefore, I would like to drive the direction of the cursor as to what cell to go next after an input is made and entered by either hitting the enter button or tab button.
View 9 Replies
View Related
Mar 29, 2012
I have a date in column A. I want to format to YELLOW column F based on whether column F is blank and 20 days past column A. I also want the formatting to change colors to RED if it remains blank past 30 days. Then, when column F is filled in I want the formatting to be removed.
I am working in Excel 2010
View 1 Replies
View Related
Jan 4, 2013
I have two worksheets (Sheet1 and Sheet2). Based on meeting a condition on Sheet1 AND Sheet2, I'd like to use macros to automatically hide rows on Sheet2.
Sheet1 sample:
Type
Selection
[Code]...
The conditions are: If on Sheet1, a Type has the Selection "Include", then any rows on Sheet2 which have that same Type are shown (ie. not hidden).
If on Sheet1, a Type has the Selection "Exclude",then any rows on Sheet2 which have that same Type are hidden.
So in the example tables above, if ONLY Type A = Include, then on Sheet2, the rows for Sample URL1 and Sample URL2 are shown, and the others are hidden.
Also in the example tables above, if Type A = Include AND Type B = Include (and all other Types are Exclude), then on Sheet2, the rows for Sample URL1, Sample URL2 AND Sample URL3 are shown, and the others are hidden.
I'm fine with the concept of If... And... on the same worksheet, it's trying to get it to look at two separate worksheets I'm struggling with!!
View 3 Replies
View Related
Jan 14, 2013
I have a workbook with two worksheets, Sheet1 and Sheet 2. Based on the data entered in the 2nd column on Sheet1, I'd like a macro which hides rows for Events which do not meet the criteria entered on Sheet1.
So in the example below, on Sheet2, I only want to see rows where the Country=Scotland, AND the Location=Glasgow, AND the Start Date is greater than (or equal) the Start Date on Sheet1.
Sample of Sheet1
Country
Scotland
Location
Glasgow
Start Date (dd/mm/yyyy)
30/04/2013
[code]....
So in this scenario, only the FIRST row meets the 3 criteria (Scotland, Glasgow, date after 30th April), thus all the other rows should be hidden.
View 6 Replies
View Related
Apr 26, 2014
I'm trying to auto populate a calender style sheet in Excel 2010 based on data from a Work Schedule sheet. The work schedule sheet contains a list of jobs, with each row representing a different job. There is a column for the start date (e.g. 25/04/14) and a column for the end date (e.g. 26/04/14). There are other columns which select resources such as people and vehicles. Each resource may appear on any one of several columns for each row, e.g. Site Operative 1, Site Operative 2 etc.
On the calendar sheet, in which one cell represents one day (e.g. 25/04/14), all the dates are shown along the top going right and all the resources are shown on the left going down.
On the calender sheet, in every cell I want a formula that will look at the Work Schedule sheet and see if that particular resource is being used on that particular date. If it does, the cell can display information from another cell such as the job number or job name to which the resource is assigned; if it doesn't, the resource isn't being used so it can display "Free" or "Available".
View 2 Replies
View Related
Sep 17, 2009
I am working with a VBA userform and several textbox's, setting SetFocus and or TabIndex doesn't leave the box ready to accept input and there is no cursor shown to indicate it is ready to accept input.
View 2 Replies
View Related
Mar 3, 2008
I'm talking about the little black box that appears anytime you put the mouse on a cell, or drag the mouse around a group of cells - mine doesn't show up. I can still edit the cell, but I have to guess about which cell I am on.
how to make my dear cursor reappear?
View 1 Replies
View Related
Feb 17, 2009
I am building an inventory application in 2007. I need to track the movements of the items so I was planning on a worksheet containing the item no, date, location.
Since an item will move around and thus have multiple records, how can I extract only the latest date record for each item and store them in another worksheet ?
So I would have 2 worksheets, a. transactions, and b. current inventory. Or am I trying to reinvent the wheel. I am sure there are a lot of inventory applications already written - how do I find one? So, 2 question!..
View 5 Replies
View Related
Aug 1, 2008
I have a spreadsheet that tries to model a possible stock price movement in a column. So in column A I have all dates starting from today and in Column B a specific stock's possible stock price movemens onver the next 2 years.
So dates start at A3 and stock prices start at B3 and end at A734 and B734.
This gives me ONE possible stock movement and to get the most accurate movement, I will need to model this 20,000 times.
Therefore, I want to create a loop macro that repeat this motion 20,000 times in the columns next to A and B. So which loop effect would I need to use and how would the code look like ? This is honestly my first time attempting to use a loop macro
View 9 Replies
View Related
Apr 14, 2014
how to change cursor colour in excel 2013.
using Control PanelEase of AccessEase of Access CenterMake the mouse easier to use does not work as it will change mouse instead of cursor colour in excel 2013. e.g. original cursor colour in excel 2013 is green, change to any colours.
View 2 Replies
View Related
Mar 29, 2014
I'm in a text box in Excel 2010. I need to find the current cursor position in the line of text in the box - using VBA.
View 2 Replies
View Related
Dec 1, 2007
I want to have SUMIF and IF functions to be combined. i tried using the formula SUMIF( Timesheet!D2:D55,B2,Timesheet!F2:F55) but i want to edit the range everytime.
Can i have formula like if name = Ant merce and prj = Implementation support, then the sum will be 15 for the sumrange of Timesheet!F:F (entire F column)
View 4 Replies
View Related
Aug 16, 2013
My challenge is pulling in a data element from a file to an exisiting file based on two criteria.
Example: give me the value in cell e1 if cell b1 matches AND
File 1
A B C
1 H12377 03/05/2013 123
2 H12377 03/27/2013 276
3 H32389 05/03/2013 335
File 2
H12377 03/27/2013 _________
how do I get C2 value from file 1 (276) into file2 since column A is not unique but column A plus Column B is unique?
View 5 Replies
View Related
Jul 1, 2014
I have attached a file where there is information in the sheet Weekly with the first row showing the same month for several weeks. add a formula in the sheet Monthly which would calculate average for each month based on the first row in Weekly sheet. Plus the grouping in the Weekly sheet is done by shops and in the Monthly sheet by food, which would I imagine make the formula more complex.
View 5 Replies
View Related
Mar 13, 2008
I am wondering if I can do a formula that would tell me if the name that appears in column J or K appears more than once at the time/date slotted in columns A and B. Basically, I want to make sure that the name(s) in column J and K aren't assigned 2 different places at the same time slot (column B) on the same say (column A).
View 9 Replies
View Related
Aug 28, 2009
I am trying to sum numbers based on three counditions.
My problem the third condition needs to use a wild card. I have attached a sample file, in the last condition I am only wanting to sum numbers where the characters in the last column begins with bd*
The yellow cell contains the formula I am using.
View 4 Replies
View Related
Dec 11, 2012
I'm creating stockportfolio's based upon historical stock data. I have 300 stocks with monthly observations. Stocks are assigned to a portfolio based upon their return in the previous 6 months. I need the top 10% stocks in terms of return in previous 6 months (so 30 stocks) in one portfolio and the lowest 10% stocks in terms of returns in previous 6 months returns (so again 30 stocks) in another portfolio. Each portfolio is just a sum of the returns of the stocks that are in there.
First sheet: rows contain the return a stock had in the 6 months before the month in the left column (so january 2006 contains the return a stock would have had from july2005 -december 2005). This is done for 300 stocks. Second sheet: contains the return the stock had in that actual month (so january 2006 just contains the january 2006 return) The third sheet is where I want to create the decile portfolio's. This means that for every month i am creating 10 portfolio's: Each month "portfolio 1" should contain the sum of the returns of the stocks with the 30 highest returns in the past 6 months. "Portfolio 10" should contain the sum of the returns of the stocks with the 30 lowest pas 6 month returns. (30 is 10% of 300: that's why it is called decile portfolio)
So I should sum things from sheet 2 with the condition referring to sheet 1 where the returns of the past 6 months are displayed. I am trying formula's like =SUMIF(RANK...) but am getting no results. Somehow excel should select the right stocks and sum the 30 returns. I'm totally lost after a lot of trials.
View 1 Replies
View Related
Mar 6, 2013
I am doing a financial analysis for a hospital. I want to know how to add something to a number based on conditions. Base pay is $300 for the first 10 patients. If more then ten patients >11-20 add 40 dollars per visit if greater than >21 add 50 dollars per patient
View 3 Replies
View Related
May 20, 2009
New to the forum and in need of a bit of help. Friend of mine is in here regularly looking for assistance and tells me this is the best excel forum around. Thought I would put it to the test with a problem that is doing my head in.
The following is a table which shows a salesmans sales. He or she has sold to 8 customers.
What I need to do is show in the commission column how much they should get paid for the additional products based on this criteria.
1. If the penetration is equal to or over 41%, and he has sold the additional product for max profit of 250 then he should get £40
2. If the penetration is less than 41%, and he has sold the additional product for max profit of 250 then he should get £25
3. If he hasnt sold the product for full amount then he gets 10% of the profit, regardless of the penetration ...
View 6 Replies
View Related
Jul 13, 2009
I know that there are bunches of threads concerning lookups with multiple criteria, but I just can't figure out how to translate one to my situation. I want to return a value based on an item name which is in column A, and an operation which is in row 1.
The array from which I need to look up the value contains part number in column B, operation in column G, and the actual value I need returned in column H.
So I need to return something like this: ...
View 14 Replies
View Related
Aug 3, 2012
I am tasked with making a matrix that I cant seem to solve.
I have solved it on a small scale using
=SUMPRODUCT($E$5:$E$19,--ISNUMBER(SEARCH(O11,$C$5:$C$19)),--ISNUMBER(MATCH($D$5:$D$19,{"One","Two","Three"},0)))
The issue is that I need where {"One","Two","Three"} is to contain between 3 and 334 conditions.
Basically we have a data table that contains "channels" that have multiple affiliates under it. Then we have a data table by affiliate by country and revenue... I want revenue by Country By Channel...
View 3 Replies
View Related
Sep 25, 2012
I have this vb script which basically states if a value in column G is less than 0 then show a message box as below.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Not Intersect(Target, Range("G3:G371")) Is Nothing Then
If Target.Value < 0 Then
MsgBox "You have entered a negative figure - are you sure this is correct?"
End If
End If
End Sub
What I would like to do is extend this script so that another message box pops up based on two conditions
i.e. if a cell in column F shows string "accounts use only" AND value in the adjacent cell in column G is > 0 then MsgBox "you have entered a positive figure - are you sure this is correct?"
View 5 Replies
View Related
Aug 10, 2013
I'm trying to adjust my macro to fill the interior cell color of a row if there's a non-blank row above and below it (i.e. if there are 3 or more non-blank rows together, then fill the 2nd, 4th, etc. rows. If there are only 1 or 2 rows together, then don't fill the cells.
However, what I'm getting is filling ever other row, with this code. There seems to be an error in how I'm trying to use and If condition with 3 criteria.
Code:
Sub colorin()
Dim LastCol As Long
Dim r As Integer
r = 6
With ActiveSheet
LastCol = .Cells(5, .Columns.Count).End(xlToLeft).Column
[Code] ....
Here are some sample results (pretend cells with red text are actually cells with interior color, black text is an unfilled cell).
Rank
Name
1
Jones, Some
[Code] ......
What I'm trying to achieve is: (again, red text actually represents filled cells - can't get sample shot of actual filled cells to copy into forum post).
Rank
Name
1
Jones, Some
[Code] ...........
View 6 Replies
View Related
Nov 6, 2009
I have a workbook with 2 worksheets. The first sheet provides a summary showing the last date a person attended a specific course.
The second worksheet is a list of all courses, attendees, dates, and status. I need a function that will match the attendee and course from the Master and display the date from the master in the corresponding cell on the summary sheet....
View 9 Replies
View Related
Dec 22, 2006
In the sample that I have attached. I am trying to compare Control ID and Business Date in Sheet[Test] and Sheet[Perform], If they are the same, then populate in Sheet[Perform] Column Test Status with the corresponding row in Sheet[Test]. note that Control ID and Business Dates are not constants.
View 4 Replies
View Related
Dec 29, 2006
i am not able to solve this problem.
1- I have 3 tabs in this worksheet with the data - Tabs A , Master Data and refernce Table
2- Suppose column K in the tab " Master Data " has a record or number, they can be repeated as the new data us added every month.
3- Reference table has the list of the same data record ( numbers ) .
Now the situation is if there is a new record in the column K of the master data sheet the Macro should do the following.
a- Check for the record in the reference table , if doesnt exist then add the record in the reference table
b- create another sheet same as the sheet " A" (duplicate of
A) and name it the new record number
b- Plug the new record number in the cell B2 of the new sheet
c - Copy the row 8 from ( D8 to O8 ) in the new sheet from (D8 to
O8)from sheet A
View 5 Replies
View Related
Sep 25, 2012
I created a master data sheet to enter data manually to analyze. It contains 20 columns, and rows(continue change, because we enter data all of the days). I need to extract data to another sheet, when the user enters data in the master data sheet, but with some conditions, when the column 6 contain the word ASQ, and then extract all of the data, but the new sheet do not contain 20 columns, because the data that contains the word ASQ have only 16 columns.
View 6 Replies
View Related
Sep 28, 2012
I need to create a macro to extract data from sheet1 to sheet2.
The sheet1 contains 15 columns, and the data starts at row 5.
The sheet2 contains 15 columns, and the data starts at row 5.
We enter data all of the days, so we have like 500 rows in the sheet1.
Only 2 conditions to extract data from sheet1 to sheet2:
if the column9 of the sheet1 contains the word "NO" and column11 of the sheet1 contains the word "ASQ".
View 4 Replies
View Related
Jan 4, 2013
I am creating a document log that tracks all excel files sent and received.
I use RDBmerge to get the filenames and data from the file batches.
My current macro edits the data down to the last stage of data needed to create the log.
My example workbook shows the final stage of the RDBMerge Data "Rough_Data" and then the final data formatted needed for the Log "Final_Data"
Included on the "Rough_Data" worksheet is the Code log used to complete the "Final_Data" worksheet.
I have highlight the cell range on the "Final_Data" Sheet that I need to complete.
filenames can occur multiple times from the RDBmerge, so only one occurance of the filename is place in column B of the "Final_Data" worksheet.
The criteria is this:
A column on the "Final_Data" worksheet as been Named for Each of the possible "Record Types" from Column G of the "Rough_Data" Worksheet. ("A,B,C,D,E,I,O,P,Q,T,V,W,X,Y")
I then must look through the "Rough_Data" worksheet for the first occurrence (if any) of that record type for each filename on the "Final_Data worksheet. If an occurrence is found I then must look at the "Unique ID" & "Program" Columns of the "Rough_Data" Worksheet. The key (on the "Rough_Data" worksheet) is used to determine the code that is written to the corresponding cell.
i.e.
"Final_Data"Date
FileName
Field2
User
Direction
Method
[Code] .....
I would very much like to automate this process, as sometimes I am dealing with over a hundred files with 30 plus rows of data each.
View 9 Replies
View Related