Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need help in being able to do the following:

  • In Worksheet A I have raw data.
  • In Worksheet B I have a template with formulas.
  • The data on Worksheet A change on a weekly basis.

I need to find a way to select the raw data from Worksheet A and insert it in Workbook B. The formulas of Workbook B are at the right of where raw data should be entered and also down at the end of the raw data. Clearly my problem is that I have totals and the number of rows of raw data change.

share|improve this question
    
Can you post in what you've tried thus far? –  variant Apr 25 '12 at 21:39
add comment

1 Answer

There's a myriad of ways for doing this. I prefer to figure out how many rows I'm working with (i.e., where the data ends) and then set up my ranges based on those numbers. Determining the last row or column can also be done several ways as evidenced by several sites, including here and here. The way I do it is

lngLastRow = Cells.Find("*", searchorder:=xlByRows, searchdirection:=xlPrevious).Row
lngLastCol = Cells.Find("*", searchorder:=xlByColumns, searchdirection:=xlPrevious).Column

Once you know the last row/column, you can subtract for however many total rows you need, etc.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.