Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Select
hi. i have a worksheet which contains two columns, one with names and
the other with amounts, there is an empty cell between unique names but thre is no empty cell in between amounts because of subtotals. i need to create a macro that will select each of the unique names(may occupy one or more rows) and the coresponding amounts and paste them to a seperate worksheet. please help! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Select
Sub test()
Sh2RowCount = 1 With Sheets("Sheet1") Lastrow = .Cells(Rows.Count, "B").End(xlUp).Row For RowCount = 1 To Lastrow If .Cells(RowCount, "A").Value < "" Then MyName = .Cells(RowCount, "A").Value Else Subtotal = .Cells(RowCount, "B").Value With Sheets("Sheet2") .Cells(Sh2RowCount, "A").Value = MyName .Cells(Sh2RowCount, "B").Value = Subtotal End With Sh2RowCount = Sh2RowCount + 1 End If Next RowCount End With End Sub "tc" wrote: hi. i have a worksheet which contains two columns, one with names and the other with amounts, there is an empty cell between unique names but thre is no empty cell in between amounts because of subtotals. i need to create a macro that will select each of the unique names(may occupy one or more rows) and the coresponding amounts and paste them to a seperate worksheet. please help! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro - select | Excel Discussion (Misc queries) | |||
can't select a macro | Excel Discussion (Misc queries) | |||
Macro to select cells without a certain value and select a menu it | Excel Worksheet Functions | |||
Select a macro button with a macro | Excel Programming | |||
Select other workbook to select data in a macro. | Excel Programming |