Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tc tc is offline
external usenet poster
 
Posts: 40
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro - select puiuluipui Excel Discussion (Misc queries) 4 May 19th 10 09:44 AM
can't select a macro Donna[_2_] Excel Discussion (Misc queries) 0 May 15th 09 02:55 AM
Macro to select cells without a certain value and select a menu it Guy[_2_] Excel Worksheet Functions 9 January 2nd 09 05:21 PM
Select a macro button with a macro Spike Excel Programming 0 April 20th 06 12:31 PM
Select other workbook to select data in a macro. T Tromp Excel Programming 2 September 19th 03 01:43 PM


All times are GMT +1. The time now is 06:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"