Using Cell Address

Stubby

Board Regular
Joined
Mar 5, 2002
Messages
188
Hi

I'm sure there is an answer somewhere on the message board but I am having trouble finding it!!

Basically what I am trying to do is this:

I intend to have a userform that scans a spreadsheet and returns information from the sheet on the userform as checkboxes. A user will then have the ability to select a checkbox and the code will then insert a new row below the item that has been selected.

I can get the address of the Cell OK but I am having trouble using the address to add the new row.

I hope the above meakes sense!!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
What have you tried that's causing trouble?
I have the following code in a module:

Sub test()
Range("a4").Select
Do Until ActiveCell = "CAP"
ActiveCell.Offset(2, 0).Select
Loop
With UserForm1
.ChbTest1.Caption = ActiveCell.Value
.Tag = ActiveCell.Address
.Show
End With

End Sub

Then if the user clicks the checkbox and then the OK button I have the following code behind the OK button:

Private Sub CmdOK_Click()
Dim mYvar As Range
With UserForm1
If .ChbTest1.Value = True Then
Set mYvar = .Tag
mYvar.Offset(5, 0).Select
End If
End With

End Sub
 
Upvote 0
Is this your problem?

Set mYvar = .Tag

Try:

Set mYvar = Range(.Tag)
Thats exactly what I was looking for!!

I know it had to be something simple. I think thats my greatest downfall, I'm always thinking too complicated.

Many thanks
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,376
Members
449,080
Latest member
Armadillos

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