Results 1 to 5 of 5

Having problems with the range!

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Having problems with the range!

    Hi,

    I have been trying to expand a bit of code that was written for me to copy a selection of cells from another sheet onto the end.

    I wanted to expand it so that it auto filled the date (weekdays) into the new cells also.

    However I am having problems with the range for the autofill...

    Sub WeekA()
    Dim ws As Worksheet
    Set ws = ActiveSheet
    
    Dim Previousrow As Long
    Previousrow = Cells(Rows.Count - 5, "B").End(xlUp).Row
    
    Dim Lastrow As Long
    Lastrow = Cells(Rows.Count, "B").End(xlUp).Row
    
    Dim Newrow As Long
    Newrow = Cells(Rows.Count + 5, "B").End(xlUp).Row
    
    Sheets("Sheet2").Range("A3:I7").Copy ws.Range("A" & Rows.Count).End(3)(2)
    Range("B126:C130").AutoFill Destination:=Range("B126:C135"), Type:=xlFillWeekdays
    
    End Sub
    My hope is to generalise the above code using "Previous row, Lastrow and Newrow"

    Thanks for any help!!
    Last edited by ARowbot; 03-18-2015 at 06:58 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Range Problems
    By jamesvw68 in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 09-29-2009, 06:48 AM
  2. Range problems
    By jamesvw68 in forum Excel General
    Replies: 1
    Last Post: 09-28-2009, 09:26 AM
  3. Problems with Range
    By tneva in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-02-2009, 07:10 AM
  4. problems with a range
    By holybull in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-23-2007, 12:03 PM
  5. [SOLVED] Range problems...
    By Neil in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-24-2005, 03:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1