Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 65
Default macro to copy range

Hello,

We appreciate if anybody can help me to wrote a macro to copy a formula to a
ong range:

This is my worksheet layout more or less:

A B c
1
2
3
4
5.
..
..
..
..
I want to copy a formula in cell C4 tp range C7 upto C65000

maybe it is simple, but since my background is accountancy so I really do
not know how to make it.

Since the range will be dynamic, but it is difficult to make it, if possible
it prompts us to fill in from C7 to C.......( dots means it prompts us to
fill in celll of column C.

Thanks in advance for any idea.



--
H. Frank Situmorang
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default macro to copy range

How did you want the formula in C4 copied to C7 before it is filled down...
exactly as written or adjusted for the 3 row offset? The following macro
assumes you wanted it copied exactly as written...

Sub CopyC4ToC7ThenFillDown()
Dim LastCell As Long
LastCell = InputBox("Fill dow to which cell?")
If IsNumeric(LastCell) Then
With Worksheets("Sheet3")
If LastCell 7 And LastCell <= .Rows.Count Then
.Range("C7").Formula = .Range("C4").Formula
.Range("C7:C" & LastCell).FillDown
Exit Sub
End If
End With
End If
MsgBox "You didn't enter a valid row number"
End Sub

Rick


"Frank Situmorang" wrote in message
...
Hello,

We appreciate if anybody can help me to wrote a macro to copy a formula to
a
ong range:

This is my worksheet layout more or less:

A B c
1
2
3
4
5.
.
.
.
.
I want to copy a formula in cell C4 tp range C7 upto C65000

maybe it is simple, but since my background is accountancy so I really do
not know how to make it.

Since the range will be dynamic, but it is difficult to make it, if
possible
it prompts us to fill in from C7 to C.......( dots means it prompts us to
fill in celll of column C.

Thanks in advance for any idea.



--
H. Frank Situmorang


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 65
Default macro to copy range

Thanks Rick for your help, but could you please help me again, that what I
want to copy is just the formula in cell C4, I do not need copy the rows.
Actually I can do it manulally, but since the row could go down to more than
60,000 lines, so it takes very long eventhough I have pressed pagedown.

When I tried to use this Macro, it also overwrite celll A and B.

Thanks in advance for your help.

--
H. Frank Situmorang


"Rick Rothstein (MVP - VB)" wrote:

How did you want the formula in C4 copied to C7 before it is filled down...
exactly as written or adjusted for the 3 row offset? The following macro
assumes you wanted it copied exactly as written...

Sub CopyC4ToC7ThenFillDown()
Dim LastCell As Long
LastCell = InputBox("Fill dow to which cell?")
If IsNumeric(LastCell) Then
With Worksheets("Sheet3")
If LastCell 7 And LastCell <= .Rows.Count Then
.Range("C7").Formula = .Range("C4").Formula
.Range("C7:C" & LastCell).FillDown
Exit Sub
End If
End With
End If
MsgBox "You didn't enter a valid row number"
End Sub

Rick


"Frank Situmorang" wrote in message
...
Hello,

We appreciate if anybody can help me to wrote a macro to copy a formula to
a
ong range:

This is my worksheet layout more or less:

A B c
1
2
3
4
5.
.
.
.
.
I want to copy a formula in cell C4 tp range C7 upto C65000

maybe it is simple, but since my background is accountancy so I really do
not know how to make it.

Since the range will be dynamic, but it is difficult to make it, if
possible
it prompts us to fill in from C7 to C.......( dots means it prompts us to
fill in celll of column C.

Thanks in advance for any idea.



--
H. Frank Situmorang



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default macro to copy range

Just so you know, you still haven't stated exactly what you want to do
clearly enough... you still didn't say if you wanted an exactly copy of the
formula or if you want row references adjusted for the new location (and if
that is what you want, you will have to show us the formula so we can see
its construction), so I am still going to have to guess at what you want.
Are you looking to simply copy the exact formula in C4 into the single cell
in Column C corresponding to the row number you type into the Input Box? If
so, give this macro a try...

Sub CopyC4ToNewRow()
Dim CopyToThisRow As Long
CopyToThisRow = InputBox("Fill dow to which cell?")
If IsNumeric(CopyToThisRow) Then
With Worksheets("Sheet3")
If CopyToThisRow 7 And CopyToThisRow <= .Rows.Count Then
.Cells(CopyToThisRow, "C").Formula = .Range("C4").Formula
Exit Sub
End If
End With
End If
MsgBox "You didn't enter a valid row number"
End Sub

To press you further on this... are you ultimately trying to copy the
formula in C4 into the first blank cell after the last piece of data in
Column C? If so, give this macro a try instead (no question will be asked,
the macro will automatically find the open cell and perform the copy
operation)...

Sub CopyC4ToRowAfterLastDataCell()
Dim LastRow As Long
With Worksheets("Sheet3")
LastRow = .Cells(.Rows.Count, "C").End(xlUp).Row
.Cells(LastRow + 1, "C").Formula = .Range("C4").Formula
End With
End Sub

Rick


"Frank Situmorang" wrote in message
...
Thanks Rick for your help, but could you please help me again, that what I
want to copy is just the formula in cell C4, I do not need copy the rows.
Actually I can do it manulally, but since the row could go down to more
than
60,000 lines, so it takes very long eventhough I have pressed pagedown.

When I tried to use this Macro, it also overwrite celll A and B.

Thanks in advance for your help.

--
H. Frank Situmorang


"Rick Rothstein (MVP - VB)" wrote:

How did you want the formula in C4 copied to C7 before it is filled
down...
exactly as written or adjusted for the 3 row offset? The following macro
assumes you wanted it copied exactly as written...

Sub CopyC4ToC7ThenFillDown()
Dim LastCell As Long
LastCell = InputBox("Fill dow to which cell?")
If IsNumeric(LastCell) Then
With Worksheets("Sheet3")
If LastCell 7 And LastCell <= .Rows.Count Then
.Range("C7").Formula = .Range("C4").Formula
.Range("C7:C" & LastCell).FillDown
Exit Sub
End If
End With
End If
MsgBox "You didn't enter a valid row number"
End Sub

Rick


"Frank Situmorang" wrote in message
...
Hello,

We appreciate if anybody can help me to wrote a macro to copy a formula
to
a
ong range:

This is my worksheet layout more or less:

A B c
1
2
3
4
5.
.
.
.
.
I want to copy a formula in cell C4 tp range C7 upto C65000

maybe it is simple, but since my background is accountancy so I really
do
not know how to make it.

Since the range will be dynamic, but it is difficult to make it, if
possible
it prompts us to fill in from C7 to C.......( dots means it prompts us
to
fill in celll of column C.

Thanks in advance for any idea.



--
H. Frank Situmorang




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 65
Default macro to copy range

Thanks Rick for your help, it works now prefectly. sorry I think I have also
langguange problem to express my difficulty, because in Indonesia we seldom
speak English.

What I want also is if I do it manually the range to which I copied formula
will be highligted ( active), so what I do next is copy value, then I sorted
it because the use of the formula is if it is the same it will be deleted, so
I sorted it by the result of the formula that says " this", all the "this" I
deleted.

My question is how can we make it active, for example if I fill in the last
cell by 100, then c7 to c100 will be active (Highlighted), so that I can copy
that range to the same range, because I want it to be the value not formula
any more, coz I want to sort it manually. I do not need the macro upto here.
I just want to make the range C7 to C100 active ( for example)

Thanks in advance
--
H. Frank Situmorang


"Rick Rothstein (MVP - VB)" wrote:

Just so you know, you still haven't stated exactly what you want to do
clearly enough... you still didn't say if you wanted an exactly copy of the
formula or if you want row references adjusted for the new location (and if
that is what you want, you will have to show us the formula so we can see
its construction), so I am still going to have to guess at what you want.
Are you looking to simply copy the exact formula in C4 into the single cell
in Column C corresponding to the row number you type into the Input Box? If
so, give this macro a try...

Sub CopyC4ToNewRow()
Dim CopyToThisRow As Long
CopyToThisRow = InputBox("Fill dow to which cell?")
If IsNumeric(CopyToThisRow) Then
With Worksheets("Sheet3")
If CopyToThisRow 7 And CopyToThisRow <= .Rows.Count Then
.Cells(CopyToThisRow, "C").Formula = .Range("C4").Formula
Exit Sub
End If
End With
End If
MsgBox "You didn't enter a valid row number"
End Sub

To press you further on this... are you ultimately trying to copy the
formula in C4 into the first blank cell after the last piece of data in
Column C? If so, give this macro a try instead (no question will be asked,
the macro will automatically find the open cell and perform the copy
operation)...

Sub CopyC4ToRowAfterLastDataCell()
Dim LastRow As Long
With Worksheets("Sheet3")
LastRow = .Cells(.Rows.Count, "C").End(xlUp).Row
.Cells(LastRow + 1, "C").Formula = .Range("C4").Formula
End With
End Sub

Rick


"Frank Situmorang" wrote in message
...
Thanks Rick for your help, but could you please help me again, that what I
want to copy is just the formula in cell C4, I do not need copy the rows.
Actually I can do it manulally, but since the row could go down to more
than
60,000 lines, so it takes very long eventhough I have pressed pagedown.

When I tried to use this Macro, it also overwrite celll A and B.

Thanks in advance for your help.

--
H. Frank Situmorang


"Rick Rothstein (MVP - VB)" wrote:

How did you want the formula in C4 copied to C7 before it is filled
down...
exactly as written or adjusted for the 3 row offset? The following macro
assumes you wanted it copied exactly as written...

Sub CopyC4ToC7ThenFillDown()
Dim LastCell As Long
LastCell = InputBox("Fill dow to which cell?")
If IsNumeric(LastCell) Then
With Worksheets("Sheet3")
If LastCell 7 And LastCell <= .Rows.Count Then
.Range("C7").Formula = .Range("C4").Formula
.Range("C7:C" & LastCell).FillDown
Exit Sub
End If
End With
End If
MsgBox "You didn't enter a valid row number"
End Sub

Rick


"Frank Situmorang" wrote in message
...
Hello,

We appreciate if anybody can help me to wrote a macro to copy a formula
to
a
ong range:

This is my worksheet layout more or less:

A B c
1
2
3
4
5.
.
.
.
.
I want to copy a formula in cell C4 tp range C7 upto C65000

maybe it is simple, but since my background is accountancy so I really
do
not know how to make it.

Since the range will be dynamic, but it is difficult to make it, if
possible
it prompts us to fill in from C7 to C.......( dots means it prompts us
to
fill in celll of column C.

Thanks in advance for any idea.



--
H. Frank Situmorang






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default macro to copy range

There is nothing wrong with your language skills... it is just you were
leaving out details of what you wanted and that made it difficult to know
how to answer your question. For example, in your last message, you didn't
say which of the two subroutines is the one you decided to use. For the
first one (CopyC4ToNewRow), use this statement...

..Range("C7:C" & CopyToThisRow).Select

If you used the second subroutine (CopyC4ToRowAfterLastDataCell) instead,
then use this statement...

..Range("C7:C" & (LastRow + 1)).Select

Note there is a "dot" in front of each of those statements.

Rick


"Frank Situmorang" wrote in message
...
Thanks Rick for your help, it works now prefectly. sorry I think I have
also
langguange problem to express my difficulty, because in Indonesia we
seldom
speak English.

What I want also is if I do it manually the range to which I copied
formula
will be highligted ( active), so what I do next is copy value, then I
sorted
it because the use of the formula is if it is the same it will be deleted,
so
I sorted it by the result of the formula that says " this", all the "this"
I
deleted.

My question is how can we make it active, for example if I fill in the
last
cell by 100, then c7 to c100 will be active (Highlighted), so that I can
copy
that range to the same range, because I want it to be the value not
formula
any more, coz I want to sort it manually. I do not need the macro upto
here.
I just want to make the range C7 to C100 active ( for example)

Thanks in advance
--
H. Frank Situmorang


"Rick Rothstein (MVP - VB)" wrote:

Just so you know, you still haven't stated exactly what you want to do
clearly enough... you still didn't say if you wanted an exactly copy of
the
formula or if you want row references adjusted for the new location (and
if
that is what you want, you will have to show us the formula so we can see
its construction), so I am still going to have to guess at what you want.
Are you looking to simply copy the exact formula in C4 into the single
cell
in Column C corresponding to the row number you type into the Input Box?
If
so, give this macro a try...

Sub CopyC4ToNewRow()
Dim CopyToThisRow As Long
CopyToThisRow = InputBox("Fill dow to which cell?")
If IsNumeric(CopyToThisRow) Then
With Worksheets("Sheet3")
If CopyToThisRow 7 And CopyToThisRow <= .Rows.Count Then
.Cells(CopyToThisRow, "C").Formula = .Range("C4").Formula
Exit Sub
End If
End With
End If
MsgBox "You didn't enter a valid row number"
End Sub

To press you further on this... are you ultimately trying to copy the
formula in C4 into the first blank cell after the last piece of data in
Column C? If so, give this macro a try instead (no question will be
asked,
the macro will automatically find the open cell and perform the copy
operation)...

Sub CopyC4ToRowAfterLastDataCell()
Dim LastRow As Long
With Worksheets("Sheet3")
LastRow = .Cells(.Rows.Count, "C").End(xlUp).Row
.Cells(LastRow + 1, "C").Formula = .Range("C4").Formula
End With
End Sub

Rick


"Frank Situmorang" wrote in message
...
Thanks Rick for your help, but could you please help me again, that
what I
want to copy is just the formula in cell C4, I do not need copy the
rows.
Actually I can do it manulally, but since the row could go down to more
than
60,000 lines, so it takes very long eventhough I have pressed pagedown.

When I tried to use this Macro, it also overwrite celll A and B.

Thanks in advance for your help.

--
H. Frank Situmorang


"Rick Rothstein (MVP - VB)" wrote:

How did you want the formula in C4 copied to C7 before it is filled
down...
exactly as written or adjusted for the 3 row offset? The following
macro
assumes you wanted it copied exactly as written...

Sub CopyC4ToC7ThenFillDown()
Dim LastCell As Long
LastCell = InputBox("Fill dow to which cell?")
If IsNumeric(LastCell) Then
With Worksheets("Sheet3")
If LastCell 7 And LastCell <= .Rows.Count Then
.Range("C7").Formula = .Range("C4").Formula
.Range("C7:C" & LastCell).FillDown
Exit Sub
End If
End With
End If
MsgBox "You didn't enter a valid row number"
End Sub

Rick


"Frank Situmorang" wrote in message
...
Hello,

We appreciate if anybody can help me to wrote a macro to copy a
formula
to
a
ong range:

This is my worksheet layout more or less:

A B c
1
2
3
4
5.
.
.
.
.
I want to copy a formula in cell C4 tp range C7 upto C65000

maybe it is simple, but since my background is accountancy so I
really
do
not know how to make it.

Since the range will be dynamic, but it is difficult to make it, if
possible
it prompts us to fill in from C7 to C.......( dots means it prompts
us
to
fill in celll of column C.

Thanks in advance for any idea.



--
H. Frank Situmorang





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
Copy, Paste and Rename a Range using a macro [email protected] Excel Discussion (Misc queries) 1 April 15th 08 03:58 PM
Copy Range Data Macro Cheri Excel Discussion (Misc queries) 9 April 12th 08 03:46 AM
Need help - Macro to copy a specific range Dileep Chandran Excel Worksheet Functions 9 December 5th 06 09:10 AM
Need help - Macro to copy a specific range Dileep Chandran Excel Worksheet Functions 0 December 4th 06 10:24 AM
MACRO TO COPY TO A RANGE asuncionw Excel Discussion (Misc queries) 3 February 9th 06 04:39 PM


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