VBA for moving active cell and change the colour..

Mick Peters

Board Regular
Joined
May 18, 2015
Messages
93
I am trying to change the colour of a cell in column A from information I have on a form. I have managed to change the colour of A1 with the below code, so that part works, but I want the Range ("A1") to pick up inflation from a text box on the form (Form1.txtRow). I have tried what I can think of EG Range ("A&txtRow") and a number of other combination but I cannot get this to change the cell of the item I want. Any help would be appreciated.

Private Sub CheckBox2_Click()
Dim xRng As Range
Set xRng = Range("A1")
If CheckBox2.Value = True Then
xRng.Interior.Color = vbBlue
Else
xRng.Interior.Color = xlNone
End If
End Sub

Thank you,
Mick.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi,
If I understand you right, try changing the following line.
Code:
Set xRng = Range("A" & Form1.txtRow.text)
Regards,
Sebastian
 
Upvote 0
Hi Mick,
You're welcome! Thanks for your feedback :)
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,593
Members
452,654
Latest member
mememe101

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top