Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default inputBox if cell " ?


In my worbook have a column of 20 cells. Any one of the cells, up t
all 20, can have text in them. If there is text in those cells,
want/need an inputBox to appear so that a comment can be typed in. Th
result of the input box will go to a cell out of sight on the same pag
of the workbook in a relative location to the 20 cells.

I've thought about having commandbutton next to each cell so that th
user could select which one she/he wants. That much vba I know and ca
do. The other thought is to press a single button and programmiticall
search out the text filled cells and prompt the user for a comment (
like this idea a bit better), but only if the comment can be place
relative to cell that prompted the action

--
BigDav
-----------------------------------------------------------------------
BigDave's Profile: http://www.excelforum.com/member.php...nfo&userid=774
View this thread: http://www.excelforum.com/showthread.php?threadid=37816

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default inputBox if cell " ?

Let's assume the cells are A1:A20 and comments would go into A101:A121. Try:

Sub InsertComments()

Dim cell As Range
Dim rTextCells As Range
Dim rCommCells As Range
Dim strComment As String
Dim strMsgBoxAns As Long
Dim strInputMsg As String
Dim strMsgBoxMsg As String

Set rTextCells = ActiveSheet.[A1:A20]
Set rCommCells = ActiveSheet.[A101:A121]

strInputMsg = "Enter a comment for cell "
strMsgBoxMsg = "You hit cancel or didn't " & _
"enter a comment. Move on?"


For Each cell In rTextCells
With cell
If Not IsEmpty(.Value) Then
GoBack:
strComment = InputBox(strInputMsg & _
.Address(False, False) & ":")
If strComment < "" Then
rCommCells(.Row).Value = strComment
Else
strMsgBoxAns = MsgBox(strMsgBoxMsg, vbYesNo)
If strMsgBoxAns = vbNo Then
GoTo GoBack
End If
End If
End If
End With
Next

End Sub

---
HTH
Jason
Atlanta, GA

"BigDave" wrote:


In my worbook have a column of 20 cells. Any one of the cells, up to
all 20, can have text in them. If there is text in those cells, I
want/need an inputBox to appear so that a comment can be typed in. The
result of the input box will go to a cell out of sight on the same page
of the workbook in a relative location to the 20 cells.

I've thought about having commandbutton next to each cell so that the
user could select which one she/he wants. That much vba I know and can
do. The other thought is to press a single button and programmitically
search out the text filled cells and prompt the user for a comment (I
like this idea a bit better), but only if the comment can be placed
relative to cell that prompted the action.


--
BigDave
------------------------------------------------------------------------
BigDave's Profile: http://www.excelforum.com/member.php...fo&userid=7741
View this thread: http://www.excelforum.com/showthread...hreadid=378165


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default inputBox if cell " ?


Here's the beginnings of a solution. It's not very refined, but it
gives you a starting point

Function commenttext(incell as string) as string
If incell"" then commenttext=inputbox("enter comment for " & incell)
end function

Then in the cell where you want to put the comment text enter the
function =commenttext(A1)

Not very refined, but it gives you a start.

Or someone will come along with a completely different approach, and if
you like that one better, go for it.


--
MrShorty
------------------------------------------------------------------------
MrShorty's Profile: http://www.excelforum.com/member.php...o&userid=22181
View this thread: http://www.excelforum.com/showthread...hreadid=378165

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
Inputbox calculations and "outputbox" CC Excel Discussion (Misc queries) 0 July 14th 06 09:15 AM
inputBox calculations and msgbox or "outputBox" CC Excel Worksheet Functions 0 July 14th 06 09:11 AM
Compile Error in Excel 2004 when Inputbox contains "VBCRLF" QTP Professional Excel Discussion (Misc queries) 1 November 18th 05 11:47 PM
excel.application.run macro1 -- added code to respond "yes" to a inputbox Michael Joe Excel Programming 3 August 13th 04 10:11 PM
InputBox or...to allow nubers formulas and Ranges I mean "Type:=0+1+8" Bero Excel Programming 1 May 9th 04 11:48 PM


All times are GMT +1. The time now is 05:15 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"