Search : in
By :

Change a cell by clicking on it using VB

Last answer on Jun 13, 2009 8:58:26 am BST Bran, on Jun 11, 2009 10:04:10 pm BST 
 Report this message to moderators

Hello,
I would like to be able to change a cell's color to blue by clicking on it with the cursor using visual basic. For instance, I have 30 cells numbered 1 to 30. I want to be able to choose #4 and have it change its color automatically, but not lose the number "4" that's in the cell. How can I accomplish this please?

Configuration: Windows XP
Google

Best answers for « Change a cell by clicking on it using VB » in :
[Excel]changing cell formula to text Show [Excel]changing cell formula to text Issue Solution Notes Issue Consider that I have: In cell A4, it contains a formula =Sum(A1:B3)+A3/B2. How to extract this formula in cell A6 as a string of text? That is ... I want cell A6...
[VBA] Detecting changes in cell Show [VBA] Detecting changes in cell The Event Change feature of a sheet will detects the change in the active cell but it gives no information about the content. The example given below will help you to find out if the cell was changed,...
COD 4 - Changing Code key ShowCOD 4 - Changing Code key Issue Solution Note Issue I have call of duty 4 and singleplayer works great but my multiplayer wont. when i go on to multiplayer i can load in fine but when i go to join a server and click refrsh nothing...
[Ubuntu]Change default application to open a file Show[Ubuntu] default application to open a file When you double-click a file, a default action is executed. (For example, if you double-click a .jpg file, it is the image viewer "Eye of Gnome" which is launched). It is very easy to change...
How to change XP Serial/License number ShowHow to change XP Serial/License number Go to / Start Menu/ Run/ Type regedit and click OK. Before any operation in the registry, he should make a backup of the registry as a precaution In the Registry Editor, click File...
Download Space Easy Wallpaper Changer ShowSpace Easy Wallpaper Changer is a small program which allows you to change the wallpaper of your desktop with a single click. It is possible to change the wall paper automatically or manually. It can support the following format: JPEG, PNG, BMP...
Download Caledos Automatic Wallpaper Changer ShowCaledos Automatic Wallpaper Changer, as its name indicates, is a screen background administrator. The main features of Caledos : - it supports the image formats BMP, GIF, JPG, TIF, - easy selection of files or folders, - the possibility of...
Worksheet - Cells ShowThe Concept of a Cell A "cell" is the intersection between a line (horizontal) and a column (vertical) on a worksheet. Thus, the name of the line combined with the name of the column gives the cell's coordinates (the term address is sometimes also...
Spreadsheets - Cell Selection ShowCell Selection Spreadsheets are powerful tools for working with data. However, to work with data, it is necessary to have tools to rapidly choose the required cells. Line Selection An entire line can be chosen by clicking directly on the line...
Resistance to change ShowResistance to change To be in a position to anticipate change, it is essential to understand the risk factors and in particular the causes that prevent change. Apart from individual causes, before focusing attention on a case by case basis,...

1

 venkat1926, on Jun 13, 2009 8:58:26 am BST
  • +1

Suppose the data are in column A
try this macro

Sub test()
Dim j As Range, k As Integer, m As Integer
Dim x, cfind As Range, add As String
On Error Resume Next
 Columns("A:A").Interior.ColorIndex = xlNone
x = InputBox("type the number you want e.g 4")
Range("a1").Select
Set j = Columns("a:a").Cells.Find(what:=x, lookat:=xlWhole)

If j Is Nothing Then
MsgBox "the value " & x & " not available "
GoTo line1
End If
add = j.Address
j.Interior.ColorIndex = 3
Do
Set j = Cells.FindNext(j)
If j Is Nothing Then GoTo line1
If j.Address = add Then GoTo line1

j.Interior.ColorIndex = 3
Loop


line1:
End Sub

Reply to venkat1926