Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Help with code

I'm trying to "transfer" info typed into a cell (activecell) into a the
comments box of another cell - but can't get it working...

Sub TransferComment()
Dim MyCell As String
Dim CSource As String
CSource = ActiveCell.Value
MyCell = Application.InputBox("What Cell do you want to paste
comment in?")
Range(MyCell).AddComment CSource
ActiveCell.ClearContents
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Help with code

I think the below works, sorry for a false-alarm,,,
Jim

"Jim May" wrote in message
:

I'm trying to "transfer" info typed into a cell (activecell) into a the
comments box of another cell - but can't get it working...

Sub TransferComment()
Dim MyCell As String
Dim CSource As String
CSource = ActiveCell.Value
MyCell = Application.InputBox("What Cell do you want to paste
comment in?")
Range(MyCell).AddComment CSource
ActiveCell.ClearContents
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Help with code

I think I'd let the user point at the cell with the mouse. It makes it a bit
easier on you--since you don't have to validate that the user actually entered
an address.

Option Explicit
Sub TransferComment2()
Dim MyCell As Range

Set MyCell = Nothing
On Error Resume Next
Set MyCell = _
Application.InputBox("What Cell do you want to paste comment in?", _
Type:=8).Cells(1)
On Error GoTo 0

If MyCell Is Nothing Then
Exit Sub 'user hit cancel
End If

If MyCell.Comment Is Nothing Then
'do nothing
Else
MyCell.Comment.Delete
End If

With ActiveCell
MyCell.AddComment .Text
.ClearContents
End With

End Sub


Jim May wrote:

I'm trying to "transfer" info typed into a cell (activecell) into a the
comments box of another cell - but can't get it working...

Sub TransferComment()
Dim MyCell As String
Dim CSource As String
CSource = ActiveCell.Value
MyCell = Application.InputBox("What Cell do you want to paste
comment in?")
Range(MyCell).AddComment CSource
ActiveCell.ClearContents
End Sub


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Help with code

What does the .Cells(1) do on the end of:

Set MyCell = _
Application.InputBox("What Cell do you want to paste comment in?", _
Type:=8).Cells(1)

TIA,
Jim


" wrote in message
:

I think I'd let the user point at the cell with the mouse. It makes it a bit
easier on you--since you don't have to validate that the user actually entered
an address.

Option Explicit
Sub TransferComment2()
Dim MyCell As Range

Set MyCell = Nothing
On Error Resume Next
Set MyCell = _
Application.InputBox("What Cell do you want to paste comment in?", _
Type:=8).Cells(1)
On Error GoTo 0

If MyCell Is Nothing Then
Exit Sub 'user hit cancel
End If

If MyCell.Comment Is Nothing Then
'do nothing
Else
MyCell.Comment.Delete
End If

With ActiveCell
MyCell.AddComment .Text
.ClearContents
End With

End Sub


Jim May wrote:

I'm trying to "transfer" info typed into a cell (activecell) into a the
comments box of another cell - but can't get it working...

Sub TransferComment()
Dim MyCell As String
Dim CSource As String
CSource = ActiveCell.Value
MyCell = Application.InputBox("What Cell do you want to paste
comment in?")
Range(MyCell).AddComment CSource
ActiveCell.ClearContents
End Sub


--

Dave Peterson


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Help with code

The user could have selected multiple cells (and even multiple areas).

..cells(1) just uses the first sell of their selection.

Jim May wrote:

What does the .Cells(1) do on the end of:

Set MyCell = _
Application.InputBox("What Cell do you want to paste comment in?", _
Type:=8).Cells(1)

TIA,
Jim

" wrote in message
:

I think I'd let the user point at the cell with the mouse. It makes it a bit
easier on you--since you don't have to validate that the user actually entered
an address.

Option Explicit
Sub TransferComment2()
Dim MyCell As Range

Set MyCell = Nothing
On Error Resume Next
Set MyCell = _
Application.InputBox("What Cell do you want to paste comment in?", _
Type:=8).Cells(1)
On Error GoTo 0

If MyCell Is Nothing Then
Exit Sub 'user hit cancel
End If

If MyCell.Comment Is Nothing Then
'do nothing
Else
MyCell.Comment.Delete
End If

With ActiveCell
MyCell.AddComment .Text
.ClearContents
End With

End Sub


Jim May wrote:

I'm trying to "transfer" info typed into a cell (activecell) into a the
comments box of another cell - but can't get it working...

Sub TransferComment()
Dim MyCell As String
Dim CSource As String
CSource = ActiveCell.Value
MyCell = Application.InputBox("What Cell do you want to paste
comment in?")
Range(MyCell).AddComment CSource
ActiveCell.ClearContents
End Sub


--

Dave Peterson


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Help with code

Thanks petersod;
Appreciate your help.
Jim

" wrote in message
:

The user could have selected multiple cells (and even multiple areas).

.cells(1) just uses the first sell of their selection.

Jim May wrote:

What does the .Cells(1) do on the end of:

Set MyCell = _
Application.InputBox("What Cell do you want to paste comment in?", _
Type:=8).Cells(1)

TIA,
Jim

" wrote in message
:

I think I'd let the user point at the cell with the mouse. It makes it a bit
easier on you--since you don't have to validate that the user actually entered
an address.

Option Explicit
Sub TransferComment2()
Dim MyCell As Range

Set MyCell = Nothing
On Error Resume Next
Set MyCell = _
Application.InputBox("What Cell do you want to paste comment in?", _
Type:=8).Cells(1)
On Error GoTo 0

If MyCell Is Nothing Then
Exit Sub 'user hit cancel
End If

If MyCell.Comment Is Nothing Then
'do nothing
Else
MyCell.Comment.Delete
End If

With ActiveCell
MyCell.AddComment .Text
.ClearContents
End With

End Sub


Jim May wrote:

I'm trying to "transfer" info typed into a cell (activecell) into a the
comments box of another cell - but can't get it working...

Sub TransferComment()
Dim MyCell As String
Dim CSource As String
CSource = ActiveCell.Value
MyCell = Application.InputBox("What Cell do you want to paste
comment in?")
Range(MyCell).AddComment CSource
ActiveCell.ClearContents
End Sub

--

Dave Peterson


--

Dave Peterson


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Modification in the CODE to HIDE rows and columns that start with ZERO (code given) Thulasiram[_2_] Excel Programming 4 September 26th 06 04:15 AM
Excel code convert to Access code - Concat & eliminate duplicates italia Excel Programming 1 September 12th 06 12:14 AM
stubborn Excel crash when editing code with code, one solution Brian Murphy Excel Programming 0 February 20th 05 05:56 AM


All times are GMT +1. The time now is 03:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"