Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Copy cell contents using Input Box

I need to copy down the contents of a cell the number of cells specified in
an Input Box. I first need to find the last used cell in the column as the
data will keep apending each month. LastRow equals the number in the Input
Box and I can combine that with the Column letter, but I'm having a problem
getting the last used cell address. So if the last cell in the column is M79,
I want to copy the contents down the number of cells in the Input Box. I
hope I've explained this well enough; don't laugh too hard, I'm not very good
at this. Any help would be greatly appreciated as always.

Dim LastRow As Long
Dim FirstRow As Range
Range("M65536").End(xlUp)(1).Select
LastRow = Application.InputBox("How many categories?")
FirstRow = ActiveCell

With Worksheets("Margin %")
.Range("FirstRow:M" & LastRow).FillDown
End With
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Copy cell contents using Input Box

Dim LastRow As Long
Dim FirstRow As Range

LastRow = Application.InputBox("How many categories?")
Set FirstRow = Range("M65536").End(xlUp)

With Worksheets("Margin %")
FirstRow.Resize(LastRow).FillDown
End With


--
HTH

Bob Phillips

"cottage6" wrote in message
...
I need to copy down the contents of a cell the number of cells specified

in
an Input Box. I first need to find the last used cell in the column as

the
data will keep apending each month. LastRow equals the number in the

Input
Box and I can combine that with the Column letter, but I'm having a

problem
getting the last used cell address. So if the last cell in the column is

M79,
I want to copy the contents down the number of cells in the Input Box. I
hope I've explained this well enough; don't laugh too hard, I'm not very

good
at this. Any help would be greatly appreciated as always.

Dim LastRow As Long
Dim FirstRow As Range
Range("M65536").End(xlUp)(1).Select
LastRow = Application.InputBox("How many categories?")
FirstRow = ActiveCell

With Worksheets("Margin %")
.Range("FirstRow:M" & LastRow).FillDown
End With



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Copy cell contents using Input Box

Bob, thanks for the solution to my problem. I appreciate it very much. I
didn't try Vacation's Over's solution because yours worked and I didn't need
to, but thanks for that response as well!

"Bob Phillips" wrote:

Dim LastRow As Long
Dim FirstRow As Range

LastRow = Application.InputBox("How many categories?")
Set FirstRow = Range("M65536").End(xlUp)

With Worksheets("Margin %")
FirstRow.Resize(LastRow).FillDown
End With


--
HTH

Bob Phillips

"cottage6" wrote in message
...
I need to copy down the contents of a cell the number of cells specified

in
an Input Box. I first need to find the last used cell in the column as

the
data will keep apending each month. LastRow equals the number in the

Input
Box and I can combine that with the Column letter, but I'm having a

problem
getting the last used cell address. So if the last cell in the column is

M79,
I want to copy the contents down the number of cells in the Input Box. I
hope I've explained this well enough; don't laugh too hard, I'm not very

good
at this. Any help would be greatly appreciated as always.

Dim LastRow As Long
Dim FirstRow As Range
Range("M65536").End(xlUp)(1).Select
LastRow = Application.InputBox("How many categories?")
FirstRow = ActiveCell

With Worksheets("Margin %")
.Range("FirstRow:M" & LastRow).FillDown
End With




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Copy cell contents using Input Box

Add my isnumeric line to Bob's code and you are all set

"cottage6" wrote:

Bob, thanks for the solution to my problem. I appreciate it very much. I
didn't try Vacation's Over's solution because yours worked and I didn't need
to, but thanks for that response as well!

"Bob Phillips" wrote:

Dim LastRow As Long
Dim FirstRow As Range

LastRow = Application.InputBox("How many categories?")
Set FirstRow = Range("M65536").End(xlUp)

With Worksheets("Margin %")
FirstRow.Resize(LastRow).FillDown
End With


--
HTH

Bob Phillips

"cottage6" wrote in message
...
I need to copy down the contents of a cell the number of cells specified

in
an Input Box. I first need to find the last used cell in the column as

the
data will keep apending each month. LastRow equals the number in the

Input
Box and I can combine that with the Column letter, but I'm having a

problem
getting the last used cell address. So if the last cell in the column is

M79,
I want to copy the contents down the number of cells in the Input Box. I
hope I've explained this well enough; don't laugh too hard, I'm not very

good
at this. Any help would be greatly appreciated as always.

Dim LastRow As Long
Dim FirstRow As Range
Range("M65536").End(xlUp)(1).Select
LastRow = Application.InputBox("How many categories?")
FirstRow = ActiveCell

With Worksheets("Margin %")
.Range("FirstRow:M" & LastRow).FillDown
End With




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Copy cell contents using Input Box

Try

Dim LastRow As Long
Dim AddRows As variant

With Worksheets("Margin %")
LastRow = .Range("M65536").End(xlUp).Row
AddRows = Application.InputBox("How many categories?")
if Isnumeric(addrows) then
.Range(Cells( LastRow, 13), Cells ( LastRow + AddRows, 13)).FillDown
else
msgbox "Please input a number!"
end if
End With

"cottage6" wrote:

I need to copy down the contents of a cell the number of cells specified in
an Input Box. I first need to find the last used cell in the column as the
data will keep apending each month. LastRow equals the number in the Input
Box and I can combine that with the Column letter, but I'm having a problem
getting the last used cell address. So if the last cell in the column is M79,
I want to copy the contents down the number of cells in the Input Box. I
hope I've explained this well enough; don't laugh too hard, I'm not very good
at this. Any help would be greatly appreciated as always.

Dim LastRow As Long
Dim FirstRow As Range
Range("M65536").End(xlUp)(1).Select
LastRow = Application.InputBox("How many categories?")
FirstRow = ActiveCell

With Worksheets("Margin %")
.Range("FirstRow:M" & LastRow).FillDown
End With



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
pausing a macro to input cell contents blipityblap New Users to Excel 3 January 13th 09 11:01 PM
macro with input msg based on cell contents Janelle S[_2_] Excel Discussion (Misc queries) 2 February 9th 08 11:47 PM
Displaying cell contents based on input? Fleone Excel Programming 7 February 2nd 05 12:09 AM
Making Contents of a cell input for a Module anyuan Excel Programming 0 June 28th 04 06:49 AM
How to display contents of a cell in UserForm and take input ssexcel[_3_] Excel Programming 2 October 28th 03 12:37 AM


All times are GMT +1. The time now is 03:38 PM.

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

About Us

"It's about Microsoft Excel"