+ Reply to Thread
Results 1 to 2 of 2

Copy from a list with changing row count

  1. #1
    Registered User
    Join Date
    07-24-2011
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2010 & 2013
    Posts
    14

    Question Copy from a list with changing row count

    Hello,

    I hope someone can help me... So, what I'm looking for is a way to copy cells from a list of employees. I have already shortened the list significantly, which is based on the location... from over 700 employees down to a possible 30 rows. Now, I want to be able to copy the exact number of employees to an employees list in my form.

    Say the list is from A7 to A36, but one time the location may only have 4 employees and the next time there may be 7 employees or whatever. I tried copying the entire list and pasting the list as values, but it pastes the empty cells as duplicates - conditional formatting is on to show if a name was manually entered twice in the list.

    I have a cell showing the number of employees in the location, but I'm not sure of the code to dynamically copy from cell A7:A# based on the employee count. So, I'm always going to start in A7, but the end may change. I thought about using End(xlUp), but it stops at the last formula and I tried searching the internet for the right words, but I have had no luck.

    Can anyone show me what to use or lead me in the right direction?

    Thanks in advance for any help you can give me...

    Jay

  2. #2
    Registered User
    Join Date
    07-24-2011
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2010 & 2013
    Posts
    14

    Re: Copy from a list with changing row count

    Well, I may have found a way around it myself...

    I made a dynamic range: =OFFSET(Employees!$AA$7,0,0,Employees!$H$4,1)
    Where H4 is the number of employees and then in the macro, I go to it, copy and paste as values. Maybe it's a little crude, but it seems to work.

    If there are any other suggestions, I'm open to learning a better way... I'm really a newbie.

    Here's the code I used:
    Sub Copy_OffsetList()
    Application.ScreenUpdating = False
    Application.Goto Reference:="OffsetList"
    Selection.Copy
    Range("A7").Select
    Selection.PasteSpecial Paste:=xlPasteValues
    Application.CutCopyMode = False
    Selection.End(xlDown).Offset(1, 0).Range("A1").Select
    Application.ScreenUpdating = True
    End Sub

    Anyway, thanks... and I am open to any suggestions.
    Jay

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy data and count list number
    By brad999 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-20-2014, 09:27 AM
  2. Replies: 6
    Last Post: 11-28-2013, 11:54 AM
  3. Changing colour on changing a Data Validation List added with VBA
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-16-2011, 08:15 AM
  4. Replies: 4
    Last Post: 05-17-2011, 06:07 PM
  5. Changing named Validation list to Dynamic list.
    By GlenC in forum Excel General
    Replies: 1
    Last Post: 07-20-2006, 06:55 PM

Tags for this Thread

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