PC Review


Reply
Thread Tools Rate Thread

copy formulas on a weekly basis to next available

 
 
bjohnson
Guest
Posts: n/a
 
      11th Feb 2008
I have a large spreadsheet where I need to automatically copy formulas
in row 3 (range B3:AH3) to the next available row starting in column B
each week - column A already lists the weekly dates. In addition, I
need to make sure the previous weeks row performs a copy past value
onto itself so as not to continue to have the paste links on that row.

I am trying to write this macro so that the user can just click a
button and have it perform in the background.

Any help would be greatly appreciated.
 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      11th Feb 2008
Sub copyRwToCol()
Dim lstRw As Long
Dim c As Range
For Each c In Range("B3:AH3")
lstRw = Cells(Rows.Count, 2).End(xlUp).Row
If Not c Is Nothing Then
c.Copy
Range("B" & lstRw + 1).PasteSpecial Paste:=xlPasteValues
End If
Application.CutCopyMode = False
Next
End Sub



"bjohnson" wrote:

> I have a large spreadsheet where I need to automatically copy formulas
> in row 3 (range B3:AH3) to the next available row starting in column B
> each week - column A already lists the weekly dates. In addition, I
> need to make sure the previous weeks row performs a copy past value
> onto itself so as not to continue to have the paste links on that row.
>
> I am trying to write this macro so that the user can just click a
> button and have it perform in the background.
>
> Any help would be greatly appreciated.
>

 
Reply With Quote
 
bjohnson
Guest
Posts: n/a
 
      11th Feb 2008
Thank you! However, this copies the row's formulas into the column
and down - I need it to copy the formulas in row 3 (B3:AH3) to the
next available row that has emtpy cells starting in column B - all the
way across the row, not down the column. Then I need it to change the
formulas to values in the row previous to the row that the formulas
were just copied to.....does that make sense?

On 11 Feb, 14:16, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
> Sub copyRwToCol()
> * Dim lstRw As Long
> * Dim c As Range
> * For Each c In Range("B3:AH3")
> * lstRw = Cells(Rows.Count, 2).End(xlUp).Row
> * * If Not c Is Nothing Then
> * * * c.Copy
> * * * Range("B" & lstRw + 1).PasteSpecial Paste:=xlPasteValues
> * * End If
> * Application.CutCopyMode = False
> * Next
> End Sub
>
>
>
> "bjohnson" wrote:
> > I have a large spreadsheet where I need to automatically copy formulas
> > in row 3 (range B3:AH3) to the next available row starting in column B
> > each week - column A already lists the weekly dates. *In addition, I
> > need to make sure the previous weeks row performs a copy past value
> > onto itself so as not to continue to have the paste links on that row.

>
> > I am trying to write this macro so that the user can just click a
> > button and have it perform in the background.

>
> > Any help would be greatly appreciated.- Hide quoted text -

>
> - Show quoted text -


 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      11th Feb 2008
When I tested it on my system, it did not copy the formulas. That is why I
used PasteSpecial instead of a direct paste. If you check in the formula
window at the top, you will see that only the cell values are pasted to
column B. If you find otherwise, then there is a malfunction in your system.

"bjohnson" wrote:

> Thank you! However, this copies the row's formulas into the column
> and down - I need it to copy the formulas in row 3 (B3:AH3) to the
> next available row that has emtpy cells starting in column B - all the
> way across the row, not down the column. Then I need it to change the
> formulas to values in the row previous to the row that the formulas
> were just copied to.....does that make sense?
>
> On 11 Feb, 14:16, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
> > Sub copyRwToCol()
> > Dim lstRw As Long
> > Dim c As Range
> > For Each c In Range("B3:AH3")
> > lstRw = Cells(Rows.Count, 2).End(xlUp).Row
> > If Not c Is Nothing Then
> > c.Copy
> > Range("B" & lstRw + 1).PasteSpecial Paste:=xlPasteValues
> > End If
> > Application.CutCopyMode = False
> > Next
> > End Sub
> >
> >
> >
> > "bjohnson" wrote:
> > > I have a large spreadsheet where I need to automatically copy formulas
> > > in row 3 (range B3:AH3) to the next available row starting in column B
> > > each week - column A already lists the weekly dates. In addition, I
> > > need to make sure the previous weeks row performs a copy past value
> > > onto itself so as not to continue to have the paste links on that row.

> >
> > > I am trying to write this macro so that the user can just click a
> > > button and have it perform in the background.

> >
> > > Any help would be greatly appreciated.- Hide quoted text -

> >
> > - Show quoted text -

>
>

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      11th Feb 2008
Hold on, I just re-read your second post. I see what you mean now.

"bjohnson" wrote:

> Thank you! However, this copies the row's formulas into the column
> and down - I need it to copy the formulas in row 3 (B3:AH3) to the
> next available row that has emtpy cells starting in column B - all the
> way across the row, not down the column. Then I need it to change the
> formulas to values in the row previous to the row that the formulas
> were just copied to.....does that make sense?
>
> On 11 Feb, 14:16, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
> > Sub copyRwToCol()
> > Dim lstRw As Long
> > Dim c As Range
> > For Each c In Range("B3:AH3")
> > lstRw = Cells(Rows.Count, 2).End(xlUp).Row
> > If Not c Is Nothing Then
> > c.Copy
> > Range("B" & lstRw + 1).PasteSpecial Paste:=xlPasteValues
> > End If
> > Application.CutCopyMode = False
> > Next
> > End Sub
> >
> >
> >
> > "bjohnson" wrote:
> > > I have a large spreadsheet where I need to automatically copy formulas
> > > in row 3 (range B3:AH3) to the next available row starting in column B
> > > each week - column A already lists the weekly dates. In addition, I
> > > need to make sure the previous weeks row performs a copy past value
> > > onto itself so as not to continue to have the paste links on that row.

> >
> > > I am trying to write this macro so that the user can just click a
> > > button and have it perform in the background.

> >
> > > Any help would be greatly appreciated.- Hide quoted text -

> >
> > - Show quoted text -

>
>

 
Reply With Quote
 
bjohnson
Guest
Posts: n/a
 
      11th Feb 2008
I'm sorry - I am not making sense....the script you wrote works, but
when it pastes, it is transposing the row of formulas/value straight
down column B - I need it to paste the row across the next available
row

On 11 Feb, 15:33, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
> When I tested it on my system, it did not copy the formulas. *That is why I
> used PasteSpecial instead of a direct paste. *If you check in the formula
> window at the top, you will see that only the cell values are pasted to
> column B. *If you find otherwise, then there is a malfunction in your system.
>
>
>
> "bjohnson" wrote:
> > Thank you! *However, this copies the row's formulas into the column
> > and down - I need it to copy the formulas in row 3 (B3:AH3) to the
> > next available row that has emtpy cells starting in column B - all the
> > way across the row, not down the column. *Then I need it to change the
> > formulas to values in the row previous to the row that the formulas
> > were just copied to.....does that make sense?

>
> > On 11 Feb, 14:16, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
> > > Sub copyRwToCol()
> > > * Dim lstRw As Long
> > > * Dim c As Range
> > > * For Each c In Range("B3:AH3")
> > > * lstRw = Cells(Rows.Count, 2).End(xlUp).Row
> > > * * If Not c Is Nothing Then
> > > * * * c.Copy
> > > * * * Range("B" & lstRw + 1).PasteSpecial Paste:=xlPasteValues
> > > * * End If
> > > * Application.CutCopyMode = False
> > > * Next
> > > End Sub

>
> > > "bjohnson" wrote:
> > > > I have a large spreadsheet where I need to automatically copy formulas
> > > > in row 3 (range B3:AH3) to the next available row starting in columnB
> > > > each week - column A already lists the weekly dates. *In addition,I
> > > > need to make sure the previous weeks row performs a copy past value
> > > > onto itself so as not to continue to have the paste links on that row.

>
> > > > I am trying to write this macro so that the user can just click a
> > > > button and have it perform in the background.

>
> > > > Any help would be greatly appreciated.- Hide quoted text -

>
> > > - Show quoted text -- Hide quoted text -

>
> - Show quoted text -


 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      11th Feb 2008
If I read it right this time, this should do what you want.

Sub copyRwToCol()
Dim lstRw As Long
lstRw = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
Range("B3:AH3").Copy Range("B" & lstRw + 1)
Set ChRng = Range("B" & lstRw & ":AH" & lstRw)
ChRng.Value = ChRng.Value
End Sub


"bjohnson" wrote:

> Thank you! However, this copies the row's formulas into the column
> and down - I need it to copy the formulas in row 3 (B3:AH3) to the
> next available row that has emtpy cells starting in column B - all the
> way across the row, not down the column. Then I need it to change the
> formulas to values in the row previous to the row that the formulas
> were just copied to.....does that make sense?
>
> On 11 Feb, 14:16, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
> > Sub copyRwToCol()
> > Dim lstRw As Long
> > Dim c As Range
> > For Each c In Range("B3:AH3")
> > lstRw = Cells(Rows.Count, 2).End(xlUp).Row
> > If Not c Is Nothing Then
> > c.Copy
> > Range("B" & lstRw + 1).PasteSpecial Paste:=xlPasteValues
> > End If
> > Application.CutCopyMode = False
> > Next
> > End Sub
> >
> >
> >
> > "bjohnson" wrote:
> > > I have a large spreadsheet where I need to automatically copy formulas
> > > in row 3 (range B3:AH3) to the next available row starting in column B
> > > each week - column A already lists the weekly dates. In addition, I
> > > need to make sure the previous weeks row performs a copy past value
> > > onto itself so as not to continue to have the paste links on that row.

> >
> > > I am trying to write this macro so that the user can just click a
> > > button and have it perform in the background.

> >
> > > Any help would be greatly appreciated.- Hide quoted text -

> >
> > - Show quoted text -

>
>

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      11th Feb 2008
If you are not using absolute references on your formulas, you might be
disappointed in the results. Your new row of formulas will change their
references relative to their new location without the $ to make them absolute.

"JLGWhiz" wrote:

> Hold on, I just re-read your second post. I see what you mean now.
>
> "bjohnson" wrote:
>
> > Thank you! However, this copies the row's formulas into the column
> > and down - I need it to copy the formulas in row 3 (B3:AH3) to the
> > next available row that has emtpy cells starting in column B - all the
> > way across the row, not down the column. Then I need it to change the
> > formulas to values in the row previous to the row that the formulas
> > were just copied to.....does that make sense?
> >
> > On 11 Feb, 14:16, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
> > > Sub copyRwToCol()
> > > Dim lstRw As Long
> > > Dim c As Range
> > > For Each c In Range("B3:AH3")
> > > lstRw = Cells(Rows.Count, 2).End(xlUp).Row
> > > If Not c Is Nothing Then
> > > c.Copy
> > > Range("B" & lstRw + 1).PasteSpecial Paste:=xlPasteValues
> > > End If
> > > Application.CutCopyMode = False
> > > Next
> > > End Sub
> > >
> > >
> > >
> > > "bjohnson" wrote:
> > > > I have a large spreadsheet where I need to automatically copy formulas
> > > > in row 3 (range B3:AH3) to the next available row starting in column B
> > > > each week - column A already lists the weekly dates. In addition, I
> > > > need to make sure the previous weeks row performs a copy past value
> > > > onto itself so as not to continue to have the paste links on that row.
> > >
> > > > I am trying to write this macro so that the user can just click a
> > > > button and have it perform in the background.
> > >
> > > > Any help would be greatly appreciated.- Hide quoted text -
> > >
> > > - Show quoted text -

> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking data from one file to another on a weekly basis using a ma =?Utf-8?B?UmVkIE5lY2s=?= Microsoft Access Macros 1 8th Sep 2005 07:54 AM
IRR weekly basis cashflow alimirfarhad Microsoft Excel Worksheet Functions 1 31st Aug 2005 01:26 PM
Rebooting GC DC on a weekly basis, best practice? =?Utf-8?B?VmFuIFBvd2Vycw==?= Microsoft Windows 2000 8 5th Feb 2005 03:53 PM
Report on weekly basis =?Utf-8?B?R3JhY2U=?= Microsoft Access Reports 1 17th Dec 2004 01:24 AM
Calculating weekly avegage efficiencies on a weekly basis scaldwell Microsoft Excel Programming 0 20th Apr 2004 04:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:19 AM.