Trying To Get An X To Appear In Cell When Selected
Feb 21, 2008I am trying to restrict a cell so all that happens when clicked is an X to appear in that cell. I'm new to this so the simpler the better.
View 11 RepliesI am trying to restrict a cell so all that happens when clicked is an X to appear in that cell. I'm new to this so the simpler the better.
View 11 RepliesBasically it is a if statement saying that if the selected cell falls between 1/01/06 and 31/01/06 then Jan would be selected. The end part is not a problem; I’m just not sure how to write the one line of code that would test if the cell falls between the two dates. I attemped to create it as shown in the code attached below but wasn't successful. I used an else if statement to test the other 11 months.
Sub test()
Dim SelectDate As Range
Set SelectDate = Range("SelectedDate")
If selectedDate >= 1 / 1 / 2006 And selectedDate <= 31 / 1 / 2006 Then
ActiveSheet. PivotTables("PivotTable1").PivotFields("PnLDate").CurrentPage = _
"Jan"
ElseIf selectedDate >= 1 / 2 / 2006 And selectedDate <= 28 / 2 / 2006 Then
ActiveSheet.PivotTables("PivotTable1").PivotFields("PnLDate").CurrentPage = _
"Feb"........................
When I use the mouse pointer to select a cell I can't use the arrow keys to move to another cell while the pointer is over the cell and I can't edit the cell while the pointer is over the cell. If I move the pointer away from the cell then I can move around and edit as normal therefore I don't think this is a scroll lock issue.
This issue also happens when I select a tab. If I select a tab and then leave the pointer over the tab I selected then I can't use the arrow keys to move around the worksheet or edit a cell; if I move the pointer away from the cell then I can move around and edit as normal.
I am using MS Excel 2010.
I am using this code to hide or unhide rows of text on another sheet:
VB:
Sub ProcessSheet1ChangeOnCellJ7(ByVal Target As Range)
Dim sAddress As String
Dim sValue As String
'Get the address of the cell that changed without '$' signs
sAddress = Target.Address(False, False)
[Code]....
When the "Not Pursuing" list box option is selected (in cell "J7" or "J8" in Sheet 1) I need to add (or over-write) "Not Pursuing" to the range of cells in column "B" (in the "Tasks" sheet), but only for that particular Goal, meaning a limited range of cells in column "B". If the "Pursuing - Show All Tasks" option is selected for a Goal then these same cells need to be blank so that the appropriate person can enter their name into the cell.
The purpose for adding "Not Pursuing" automatically to these yellow highlighted cells is that it will facilitate filtering of tasks by individual in the "Tasks" sheet..
Again I have tried several times to upload a sample file and am unable to, which I know makes it more difficult to solve. (Is there some common mistake people make? I know it's an allowed format and is very small in file size....)
Code solution can be entered directly beneath:
VB:
If Target.Value = "Not Pursuing" Then
ActiveWorkbook.Sheets("Tasks").Rows("29:29").EntireRow.Hidden = False
ActiveWorkbook.Sheets("Tasks").Rows("30:48").EntireRow.Hidden = True
I am trying to do is to make it so that users can enter data into my form (I have managed to create the form and am working on trying to figure out how to get the info entered into the form to appear in my worksheet) and then the data will cause the information to, basically, compile sentences that I want to appear in one of three cells at the bottom of the worksheet.
Essentially, at this point in time, the end goal is to make 3 cells that contain text. Eventually, this text will be indexed elsewhere, but that is for the next person to deal with. I am creating a prototype that I want to present as a process improvement.
So, when the user selects 3 in cell D7 I want the text "Customer purchased 3 Widgets at $20 each." to print in cell 82B.
I also want the user to be able to copy and paste some customer records from another program directly into a cell in the form that will just print (unchanged) into one of these boxes, too.
Lastly, I want the user to be able to select checkboxes that will, when selected, print a comment that will print in two of these boxes. For example, if the user selects yes for cell D26 then I want the text "Customer not eligible for free shipping" to appear in both cells C82 and D82.
I have big library books database file. now i want to re check all the book with physical stock and mark in excel file.
i have one more file with books barcode no.
now i want to mark multiple cell in sheet..
i am currently using the macro below to import text files into a spreadsheet. Currently, it begins the import in cell A1 which is what I recorded it to do. how do I change the code to begin the import on the active cell?
View 2 Replies View RelatedMacros question - The user enters a word, e.g. Malaysia in a particular cell (always the same location) and I want the macro to be able to find the next cell with that word in it, but it appears that when using macros you can't paste anything into the find function, so was just wondering what to do!
View 1 Replies View RelatedBasically I have a filtered list in colunms A to D. The user selects a cell in column A and I want to then be able to run a macro which copies that cell and the adjacent one in column B, into columns A and B on sheet2.
The complications are
Column B on the second sheet is merged with columns D to E so a straight forward cut and paste of A and B on sheet 1 into A and B on sheet 2 will not work in one cut and paste as it complains about merged cells. It would need to copy and paste A and then copy and paste B to avoid the error.
The row on sheet 2 where it is being pasted needs to be the first row between row 10 and row 30 where col A is blank (so it doesnt overwrite a previous copy and paste as they are basically creating a list on sheet 2 in those rows by runing this macro repeatedly). if there is no blank row then it should insert a new row at row 10 and paste into that
Sheet 1 is a table with the first column and first row as text (table headings). The first column is names and first row is from report names.Namereport 1report 2Jane Doe114John Doe52
Sheet 2 is the report1, for example purposes
NameJane DoeJane DoeJane DoeJane DoeJane DoeJane DoeJane DoeJane DoeJane DoeJane DoeJane DoeJohn DoeJohn DoeJohn DoeJohn DoeJohn Doe
I am trying to have it to so that when you double click on cell B2 of sheet1, it will go to sheet2 and autofilter on the value to the left of B2 on sheet1 "Jane Doe"
This is what I have so far but when I double click on B2 it just moves the cursor to the cell to the left instead of filtering on the value of the cell to the left on sheet2.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim id As String
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(0, -1).Select
Else
id = CStr(Selection)
Sheet2.Activate
Sheet2.Range("A1:A500").AutoFilter Field:=1, Criteria1:=IsEmpty(ActiveCell) = False And ActiveCell.Offset(0, -1).Value.id
End If
End Sub
How would I get a particular cell to display the contents of any cell that might be selected.
ie, if I click on A1 I want A2 to display the info thats in A1, and if after that, I click on E12, I want A2 to then show E12's info, etc etc.
to find event that is triggered when cell is selected.
Or maybe there is a better way to do this?
This is what i want:
When user clicks given cell form will pop up letting user choose cell value from Combo box.
I wanted to use Cell Selected event and just pop up Form but maybe i can do it withought VB.
Is there a way to limit possible cell values to few predefined values?
So user cant put there whatever he/she wants?
The outline that indicates my selected cell is a very pale blue which I can hardly see. how to change it to black or some color I can see?
View 3 Replies View RelatedWhen I write a macro in Worksheet_SelectionChange event, excel doesn't know the Target.Address if the cell is selected via Tab key or selected via search feature of excel. It only recognizes the Target if it is selected via mouse click.
Is there a way around this, so the selection_change event would respond properly?
I would like to instantly mirror any selected cell within a specific column into another specified cell.
Example:
If A1 has the value 4, A2 has the value 6, A3 has 7, A4 has 9, and I click on those cells in the order above, I would like to see the cell I specify show the same value when I've selected (clicked on) them.
A macro was submitted in a similar thread, but I have a slightly different problem. I have empty cells, A1:A10, and in cells C1:C10 I have data. If A1 is selected, I would like to be able to click on any cell in colum C and that info then appears in A1. Then I will select A2, and again, click on any cell in C1:C10 and that appears in A2 and so on. I do not want cells A1 etc. to
change once populated. This can be a macro as well.
Can anyone help me in finding how to write the command in VBA to determine what Cell was selected in a worksheet? The objective is to know what Cell has been selected by double click event to pop up a userform with a calendar from which the user can select the date. I am looking at making it dynamic so I do not select a particular range.
Can this be achieved? I guess yes, but how?
I'm lost on VBA, but I have been successful at recording a few extremely simple macros. I have a number of pdf statements that I have run through OCR, and the OCR often misses the decimal point so that 43.85 comes out as 4385. (this is in dollars, so everything has 2 decimals).
These cells are usually pretty easy to spot, so I want to select that cell, press a keystroke or 2, and divide the value in that cell by 100. I assumed that by selecting "relative cell references", and recording a macro with the keystrokes "<F2>/100<HOME>=" (without the quotes, of course), I would accomplish that. But instead, it places a constant in that cell, with the value obtained in the cell where I recorded the macro.
I need to delete part of the row where one cell is selected. If more than 1 cell is selected, I want a msgbox. Example: I have any cell selected on row 26. I want to select all cells in this row including column C thru column AD. Column A & B are not to be deleted. After the selection is made, I want the row deleted and the below cells moved up.
View 3 Replies View RelatedI just want to run a macro when a certain cell is selected.
upon investigation, i have found that I can right click on the sheet tab and
view the code. I can then add the following
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$a$1" Then
run(macro1)
end if
End Sub
know if there is a way to tell and respond differently to how a cell is selected (i.e. mouse click versus arrow keys)? This stems from a desire to highlight selected cells when they are chosen. A previous post on some code I provided got me to this:
Code:
Private Sub Worksheet_SelectionChange(ByVal target As Range)
Application.EnableEvents = False
With target.Interior
Select Case .ColorIndex
Case -4142
[code]....
However, this highlights cells as the user moves around the sheet via arrow keys (like leaving a trail). What I need is for cells to highlight ONLY if they are left clicked on by the mouse.
I have a commandbutton which sends my selected row in an email to a recipient as a reminder that they need to act on information in the row.
When the function runs i want to to add a date that the reminder mail was sent in a specific cell on that selected row. However i am having trouble.
Cells(SelectedRow, "M").Value = %DATE%
I've tried some different things but i cant figure out how to handle the arguments for Cells() to point to my actual selected row.
I work with many sheets that have many data columns and have used a "greenbar" formula in conditional formating but would like to have a similar formula that highlights the current row. If possible, it would be nice if this new formula would not wipe out all other formatting as it moves.
I have seen Ivan's work at www.mrexcel.com/hof001.php but it says that it wipes out other formatting.
The formula that I am currently using is =MOD(ROW(),3)=2
Is there a way of getting the current row number so that it could be
=ROW()=(current row number) ?
I know how to select an entire row, but if I want the "row" with active cell to be highlighted when I press enter, or the down arrow key, is there a way to do that (mainly for ease of viewing).
I've seen plenty of code for running a macro when various events occur, but how do I run a macro when a cell is simply selected? I have a calendar Macro, and there are two cells that need date input. I want the user to select the cell, and the calendar to pop up. Macro for the calendar works correctly, just need the code for the activation upon cell selection.
View 9 Replies View RelatedI would like to achieve the affect where if you click on the cell its contents will change. For example, if you click on it once, a checkmark will appear, but if you click on it twice and x and if you click on it a third time a - will be displayed.
I was thinking along the lines of a marco for the spreadsheet, which would run an if loop to check what was currently in the cell then change accordingly. Is there a command that would allow me to do this, or would is there an even easier way? side note how would I even display a checkmark of square root sign, through vba? This is what I have, It was working but now it does nothing and I cant remember what I tinkered with.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
If Target.Column = 6 Then
If Cells(Target.Row, 6) = "" Or Cells(Target.Row, 6) = "-" Then
Cells(Target.Row, 6).Formula = ""
Application.EnableEvents = True
ElseIf Cells(Target.Row, 6) = "?" Then
Cells(Target.Row, 6).Formula = "x"
Application.EnableEvents = True
Else
Cells(Target.Row, 6).Formula = "-"
Application.EnableEvents = True
End If
End If
Application.EnableEvents = True
End Sub
My task is to create a sub-routine that filters a column to the currently selected value while capturing the column header for use in a second sub-routine that finds the corresponding column in the second worksheet and filters it using the value from the first worksheet
View 2 Replies View RelatedI have a number of pictures on sheet 1 that display names from cells in sheet 2
E.g.
Cell B1 in Sheet 2 has the value "Bob Jones"
Cell B2 in Sheet 2 has the value "Ian Jones"
In sheet 1 Picture1 has the formula =Sheet2!$B$1 so that the picture displays "Bob Jones"
Picture2 has the formula =Sheet2!$B$2 so that the picture displays "Ian Jones"
I have about 30 pictures displaying names in this way, but I want the name of the chosen picture to also appear in cell A1.
E.g. On sheet 1 user clicks on Picture 1 (Bob Jones), the name "Bob Jones" appeas in Cell A1
User clicks on Picture 2 (Ian Jones), the name "Ian Jones" appeas in Cell A1
I am running the below macro which work fine ! However after running the macro, I do not stay in the cell I was!! How to stay in the selected cell?
HTML Code:Â
Sub INSERT()
ActiveSheet.Unprotect Password:="P@ssw0r!"
ActiveCell.EntireRow.INSERT
Range("FORMULA1,FORMULA2,FORMULA3,FORMULA4").Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect Password:="P@ssw0r!", AllowFormattingCells:=True
End Sub
i have data in range c10:h100
i want if select a cell e.g = c15 then
highlight the range c10:c100 with color
now highlight the all row only highlight defined range