Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default select a range with a dialog box

Sub UPPERFirst3()
Dim myRange as Range
Dim myCell As Range

set myRange= Application.Inputbox("Select range with mouse",Type:=8)
For Each myCell In myRange
myCell.Value = UCase(Left(myCell.Value, 3)) & Mid(myCell.Value, 4,
Len(myCell.Value) - 3)
Next myCell
End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Dave F" wrote in message
...
I have the following macro which capitalizes the first three characters in
each cell of a selected range:

Sub UPPERFirst3()
Dim myCell As Range

For Each myCell In Selection
myCell.Value = UCase(Left(myCell.Value, 3)) & Mid(myCell.Value, 4,
Len(myCell.Value) - 3)
Next myCell
End Sub

I've attached this macro to a button.

What I would like to do is modify this code so that when you click the
button, a dialog box pops up which asks you to enter the range (say
A1:A10000). Then when you click OK the rest of the macro (i.e., what I
pasted above) would iterate through the range.

How do I do this? Do I use InputBox? MsgBox?

Thanks,

Dave
--
Brevity is the soul of wit.



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
Dialog box for user to select a folder hmm Excel Programming 6 November 22nd 06 10:09 AM
select adjustment tab in cell format dialog x taol Excel Programming 2 January 22nd 06 04:31 AM
Using Dialog to select a Workbook, Worksheet and Range Tony Starr[_3_] Excel Programming 2 June 24th 05 07:21 AM
Select Sheet then Select Range Gee[_2_] Excel Programming 3 May 27th 04 10:10 PM
Prompt user to select file with default file selected dialog Bob Phillips[_5_] Excel Programming 0 September 14th 03 09:22 PM


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