Please see attached excel file
what i want is that on the next sheet, whatever books i have ordered, they should be populated. so maybe a vlookup or something would be the solution? not sure how to go about it..
please help
thanks
Please see attached excel file
what i want is that on the next sheet, whatever books i have ordered, they should be populated. so maybe a vlookup or something would be the solution? not sure how to go about it..
please help
thanks
try this VBA solution:
![]()
Option Explicit Sub books() Dim sh1 As Worksheet, sh2 As Worksheet Set sh1 = Sheets("Sheet1") Set sh2 = Sheets("Sheet2") Dim lr1 As Long, lr2 As Long, i As Long lr1 = sh1.Range("A" & Rows.Count).End(xlUp).Row lr2 = sh2.Range("A" & Rows.Count).End(xlUp).Row sh2.Range("A1:D" & lr2).ClearContents With sh1 .Range("A1:D1").Copy sh2.Range("A1") For i = 2 To lr1 lr2 = sh2.Range("A" & Rows.Count).End(xlUp).Row If .Range("C" & i) <> "" Then .Range("A" & i & ":D" & i).Copy sh2.Range("A" & lr2 + 1) End If Next i End With End Sub
How to install your new code
- Copy the Excel VBA code
- Select the workbook in which you want to store the Excel VBA code
- Press Alt+F11 to open the Visual Basic Editor
- Choose Insert > Module
- Edit > Paste the macro into the module that appeared
- Close the VBEditor
- Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)
To run the Excel VBA code:
- Press Alt-F8 to open the macro list
- Select a macro in the list
- Click the Run button
Alan עַם יִשְׂרָאֵל חַי
Change an Ugly Report with Power Query
Database Normalization
Complete Guide to Power Query
Man's Mind Stretched to New Dimensions Never Returns to Its Original Form
This array formula** entered on Sheet2 in cell A2:
=IF(ROWS(Sheet1!A$2:A2)>COUNT(Sheet1!C:C),"",INDEX(Sheet1!A:A,SMALL(IF(ISNUMBER(Sheet1!C$2:C$16),ROW(Sheet1!C$2:C$16)),ROWS(Sheet1!A$2:A2))))
** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.
Copy down until you get blanks.
Biff
Microsoft MVP Excel
Keep It Simple Stupid
Let's Go Pens. We Want The Cup.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks