Copy selected cells

  • Thread starter Thread starter jeff.white
  • Start date Start date
J

jeff.white

I have what I think is an easy one.

I have a sheet that has about 500 rows. In Column A everything is
blank. In Column B maybe blank, but there are some notes in some of
the cells. What I'm trying to do is IF, there are notes in cell B10
for example I would like the user to beable to click that cell, B10
and have the contents copied from B10 to A10.

The macro would only fire any cell in column B....make sense? Thanks
for your help!!
 
How about double-click:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Intersect(Range("B:B"), Target) Is Nothing Then
Exit Sub
End If
If IsEmpty(Target) Then
Exit Sub
End If
Target.Copy Target.Offset(0, -1)
Cancel = True
End Sub

this goes in worksheet code, not a standard module
 
Why not do this when the user double clicks:

right click on the sheet tab and select View code. Put in code like this:

Private Sub Worksheet_BeforeDoubleClick(ByVal _
Target As Range, Cancel As Boolean)
If target.count = 1 then
if Target.column = 2 then
if not isempty(Target) then
Target.offset(0,-1).value = target.value
Cancel = True
end if
end if
end if
End Sub

by note I assume you mean text in the cell; not a cell comment.
 
How about double-click:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Intersect(Range("B:B"), Target) Is Nothing Then
Exit Sub
End If
If IsEmpty(Target) Then
Exit Sub
End If
Target.Copy Target.Offset(0, -1)
Cancel = True
End Sub

this goes in worksheet code, not a standard module
--
Gary''s Student
gsnu200711







- Show quoted text -

Perfect...thanks...I like the double click option....Thanks..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top