![]() |
Creating a Checkbox inside a cell for each line
I am importing a text file into spreadsheet one line at a time, I
would like to add a checkbox for each line for the user to be able to select multiple rows. How do i create a checkbox in a cell? Then remove it. |
Creating a Checkbox inside a cell for each line
Randy,
Here is an laternative approach I have previously suggested Another way is to use this technique of having a check column, and monitoring it with a worksheet selection change event. Add your code as needed. Rather than use a checkbox, I suggest just using a check column. So if we assume that the data is in A1:E100 (change to suit), clicking in column A will do what you want with this code. Add this code to the worksheet module (right-click on the sheet name tab, select the View option, and then paste this code in). Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.EnableEvents = False On Error GoTo sub_exit If Not Intersect(Target, Range("A1:A100")) Is Nothing Then With Target If .Value = "a" Then .Value = "" Else .Value = "a" .Font.Name = "Marlett" End If End With End If sub_exit: Application.EnableEvents = True End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Randy Reese" wrote in message ... I am importing a text file into spreadsheet one line at a time, I would like to add a checkbox for each line for the user to be able to select multiple rows. How do i create a checkbox in a cell? Then remove it. |
Creating a Checkbox inside a cell for each line
I when with this code, trying to use checkboxes slowed the system down
to a crawl. Sometimes the rows can be thousands long. Now I would like to make the row background color yellow when checked, can you help with this, I can make the same cell change but not the row. On Thu, 19 Feb 2004 15:53:31 -0000, "Bob Phillips" wrote: Randy, Here is an laternative approach I have previously suggested Another way is to use this technique of having a check column, and monitoring it with a worksheet selection change event. Add your code as needed. Rather than use a checkbox, I suggest just using a check column. So if we assume that the data is in A1:E100 (change to suit), clicking in column A will do what you want with this code. Add this code to the worksheet module (right-click on the sheet name tab, select the View option, and then paste this code in). Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.EnableEvents = False On Error GoTo sub_exit If Not Intersect(Target, Range("A1:A100")) Is Nothing Then With Target If .Value = "a" Then .Value = "" Else .Value = "a" .Font.Name = "Marlett" End If End With End If sub_exit: Application.EnableEvents = True End Sub |
All times are GMT +1. The time now is 12:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com