Add more than one column to range and remove error on multiple selections

mikedevt

New Member
Joined
Feb 5, 2018
Messages
6
I set up a spreadsheet so that you could edit a cell through a text box, the only problem is that it is limited to one column and when you select more than one cell, there is an error message. I have tried changing traget.column = 7 to target.range = ("A1:CA300") and target.adress = ("A:CA"), but nothing works.

Here is my working code:


Code:
Dim PreviousCell As Range


Private Sub Worksheet_SelectionChange(ByVal Target As Range)


    If Target.Column = 7 Then ActiveSheet.TextBox1.Text = Target
   
    If Not PreviousCell Is Nothing Then
        Debug.Print PreviousCell.Address
    End If


    Set PreviousCell = Target ' This needs to be the last line of code.
       
End Sub




Private Sub TextBox1_Change()


ActiveCell.Value = TextBox1


End Sub
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Cross posted https://www.excelforum.com/excel-pr...lumn-and-remove-error-on-multi-selection.html

Cross-Posting
While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,215,393
Messages
6,124,680
Members
449,180
Latest member
kfhw720

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