close

I'm trying to create a VBA scenario in Excel 2003 where an Input Box appears
asking the user to type a desired cell range (e.g. A1:B6) from a specified
worksheet (e.g. Sheet1) in the Input Box, and then have the values that sit
in whatever cell address range the user typed in the Input Box to copy and
paste to another specified worksheet (e.g. Sheet2). In other words, if the
user types A1:B6 in the Input Box, the VBA will copy and paste the values in
cells A1 thru B6 in sheet 1 over to sheet2 starting in cell A4. I have some
of the code hammered out but am stuck. Any suggestions? Thank you.

Rather than get them to type it in, use

Set rng = Application.Inputbox(quot;Select rangequot;,Type:=8)

which allows them to select the range with the mouse. You can then simply
copy that range

rng.Copy Worksheets(quot;otherquot;).Rangequot;A1quot;)

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

quot;dddiversquot; gt; wrote in message
...
gt; I'm trying to create a VBA scenario in Excel 2003 where an Input Box
appears
gt; asking the user to type a desired cell range (e.g. A1:B6) from a specified
gt; worksheet (e.g. Sheet1) in the Input Box, and then have the values that
sit
gt; in whatever cell address range the user typed in the Input Box to copy and
gt; paste to another specified worksheet (e.g. Sheet2). In other words, if
the
gt; user types A1:B6 in the Input Box, the VBA will copy and paste the values
in
gt; cells A1 thru B6 in sheet 1 over to sheet2 starting in cell A4. I have
some
gt; of the code hammered out but am stuck. Any suggestions? Thank you.
Fantastic! Thank you.

quot;Bob Phillipsquot; wrote:

gt; Rather than get them to type it in, use
gt;
gt; Set rng = Application.Inputbox(quot;Select rangequot;,Type:=8)
gt;
gt; which allows them to select the range with the mouse. You can then simply
gt; copy that range
gt;
gt; rng.Copy Worksheets(quot;otherquot;).Rangequot;A1quot;)
gt;
gt; --
gt; HTH
gt;
gt; Bob Phillips
gt;
gt; (remove nothere from email address if mailing direct)
gt;
gt; quot;dddiversquot; gt; wrote in message
gt; ...
gt; gt; I'm trying to create a VBA scenario in Excel 2003 where an Input Box
gt; appears
gt; gt; asking the user to type a desired cell range (e.g. A1:B6) from a specified
gt; gt; worksheet (e.g. Sheet1) in the Input Box, and then have the values that
gt; sit
gt; gt; in whatever cell address range the user typed in the Input Box to copy and
gt; gt; paste to another specified worksheet (e.g. Sheet2). In other words, if
gt; the
gt; gt; user types A1:B6 in the Input Box, the VBA will copy and paste the values
gt; in
gt; gt; cells A1 thru B6 in sheet 1 over to sheet2 starting in cell A4. I have
gt; some
gt; gt; of the code hammered out but am stuck. Any suggestions? Thank you.
gt;
gt;
gt;

全站熱搜
創作者介紹
創作者 software 的頭像
software

software

software 發表在 痞客邦 留言(0) 人氣()