Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Prompt for Start Row

I have the below code set up which is working well.

What I need to do is prompt the user for the starting row for the copy/paste
range. For instance, this week the copy range may be C71:D309 and next week
the range may be C78:D309. The only thing that will change is the beginning
row. How do I do that?

THANKS!

Sub CopyCashFlowLAO()

Dim RngToCopy As Range
Dim DestCell As Range


With Workbooks("LAO Cash Flow Input
Template-ARG.xls").Worksheets("Argentina ARS")
Set RngToCopy = .Range("C71:D309")
End With

With ActiveWorkbook.Worksheets("Argentina ARS")
Set DestCell = .Range("c71")
End With

RngToCopy.Copy
DestCell.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

With Workbooks("LAO Cash Flow Input
Template-ARG.xls").Worksheets("Argentina ARS")
Set RngToCopy = .Range("G71:G309")
End With

With ActiveWorkbook.Worksheets("Argentina ARS")
Set DestCell = .Range("G71")
End With

RngToCopy.Copy
DestCell.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

With Workbooks("LAO Cash Flow Input
Template-ARG.xls").Worksheets("Argentina ARS")
Set RngToCopy = .Range("I71:I309")
End With

With ActiveWorkbook.Worksheets("Argentina ARS")
Set DestCell = .Range("I71")
End With

RngToCopy.Copy
DestCell.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Prompt for Start Row

use:

n = Application.InputBox(prompt:="enter starting row", Type:=1)
Set RngToCopy = .Range("C" & n & ":D309")

in place of your Set statement
--
Gary''s Student - gsnu200832


"JenL" wrote:

I have the below code set up which is working well.

What I need to do is prompt the user for the starting row for the copy/paste
range. For instance, this week the copy range may be C71:D309 and next week
the range may be C78:D309. The only thing that will change is the beginning
row. How do I do that?

THANKS!

Sub CopyCashFlowLAO()

Dim RngToCopy As Range
Dim DestCell As Range


With Workbooks("LAO Cash Flow Input
Template-ARG.xls").Worksheets("Argentina ARS")
Set RngToCopy = .Range("C71:D309")
End With

With ActiveWorkbook.Worksheets("Argentina ARS")
Set DestCell = .Range("c71")
End With

RngToCopy.Copy
DestCell.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

With Workbooks("LAO Cash Flow Input
Template-ARG.xls").Worksheets("Argentina ARS")
Set RngToCopy = .Range("G71:G309")
End With

With ActiveWorkbook.Worksheets("Argentina ARS")
Set DestCell = .Range("G71")
End With

RngToCopy.Copy
DestCell.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

With Workbooks("LAO Cash Flow Input
Template-ARG.xls").Worksheets("Argentina ARS")
Set RngToCopy = .Range("I71:I309")
End With

With ActiveWorkbook.Worksheets("Argentina ARS")
Set DestCell = .Range("I71")
End With

RngToCopy.Copy
DestCell.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Prompt for Start Row

Thanks a bunch Gary!!! It worked great!!

"Gary''s Student" wrote:

use:

n = Application.InputBox(prompt:="enter starting row", Type:=1)
Set RngToCopy = .Range("C" & n & ":D309")

in place of your Set statement
--
Gary''s Student - gsnu200832


"JenL" wrote:

I have the below code set up which is working well.

What I need to do is prompt the user for the starting row for the copy/paste
range. For instance, this week the copy range may be C71:D309 and next week
the range may be C78:D309. The only thing that will change is the beginning
row. How do I do that?

THANKS!

Sub CopyCashFlowLAO()

Dim RngToCopy As Range
Dim DestCell As Range


With Workbooks("LAO Cash Flow Input
Template-ARG.xls").Worksheets("Argentina ARS")
Set RngToCopy = .Range("C71:D309")
End With

With ActiveWorkbook.Worksheets("Argentina ARS")
Set DestCell = .Range("c71")
End With

RngToCopy.Copy
DestCell.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

With Workbooks("LAO Cash Flow Input
Template-ARG.xls").Worksheets("Argentina ARS")
Set RngToCopy = .Range("G71:G309")
End With

With ActiveWorkbook.Worksheets("Argentina ARS")
Set DestCell = .Range("G71")
End With

RngToCopy.Copy
DestCell.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

With Workbooks("LAO Cash Flow Input
Template-ARG.xls").Worksheets("Argentina ARS")
Set RngToCopy = .Range("I71:I309")
End With

With ActiveWorkbook.Worksheets("Argentina ARS")
Set DestCell = .Range("I71")
End With

RngToCopy.Copy
DestCell.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

End Sub

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
how do i set up a user prompt at the start of an excel workbook ? Mark Excel Worksheet Functions 1 February 11th 10 10:04 AM
Prompt for start row JenL Excel Programming 0 February 9th 09 06:26 PM
start up prompt for updating links egarcia Excel Discussion (Misc queries) 2 February 26th 07 05:36 PM
start learning Excel/VBA, where to start from? Any online video lectures? cfman Excel Programming 8 September 29th 06 10:40 AM
OT :Start your own online business today !start making dollars [email protected] Excel Discussion (Misc queries) 0 May 6th 06 09:29 PM


All times are GMT +1. The time now is 05:57 PM.

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"