Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Display selected rows and columns in a pop-up window.


Hi,

I have a spreadsheet "lw1" with 25,000 rows and 21 columns.

Most of column C is usually blank.
But when column C is not blank, I would like to:

1. Grab columns A, B, C, G, H, J and K from all the rows
where column C is not blank.

2. Display these rows in a pop-up window.

3. With the column headings "1st", "2nd", "3rd", "4th",
"5th", "6th", "7th".

4. Add a (new) last column to pop-up window
called "calculated".

5. Where "calculated" is C+(C*G)+J in each row.

6. As soon as the user clicks on the "OK" button in the
pop-up window, I would like to save the contents
of the pop-up window into a csv file.

Can you give me the VBA code for this so that I can add it to
button?

Thanks,
Luthe

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Display selected rows and columns in a pop-up window.

Sub ShowData()
Dim rng As Range, rng1 As Range
Dim wkbk As Workbook
Dim sh As Worksheet
With Worksheets("lw1")
Set rng = .Range("A1").CurrentRegion.Resize(, 11)
rng.AutoFilter Field:=3, Criteria1:="<"
End With
Set wkbk = Workbooks.Add(xlWBATWorksheet)
Set sh = wkbk.Worksheets(1)
rng.Copy sh.Range("A1")
sh.Range("D:F,I:I").EntireColumn.Delete
sh.Range("A1:G1").Value = Array("1st", "2nd", "3rd", "4th", _
"5th", "6th", "7th")
Set rng1 = sh.Range("A1").CurrentRegion
Set rng1 = rng1.Offset(1, 0).Resize(rng1.Rows.Count - 1)
Load UserForm1
UserForm1.ListBox1.ColumnCount = 7
UserForm1.ListBox1.ColumnHeads = True
UserForm1.ListBox1.RowSource = rng1.Address(external:=True)
UserForm1.Show
wkbk.SaveAs FileName:="C:\Data\Myfile.csv", FileFormat:=xlCSV
wkbk.Close SaveChanges:=False
End Sub

You need to have a userform1 with a listbox named listbox1 and an OK button
that unloads the userform.

--
Regards,
Tom Ogilvy



lothario wrote in message
...

Hi,

I have a spreadsheet "lw1" with 25,000 rows and 21 columns.

Most of column C is usually blank.
But when column C is not blank, I would like to:

1. Grab columns A, B, C, G, H, J and K from all the rows
where column C is not blank.

2. Display these rows in a pop-up window.

3. With the column headings "1st", "2nd", "3rd", "4th",
"5th", "6th", "7th".

4. Add a (new) last column to pop-up window
called "calculated".

5. Where "calculated" is C+(C*G)+J in each row.

6. As soon as the user clicks on the "OK" button in the
pop-up window, I would like to save the contents
of the pop-up window into a csv file.

Can you give me the VBA code for this so that I can add it to a
button?

Thanks,
Luther


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Display selected rows and columns in a pop-up window.


Thanks Tom

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

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
How do I get excel to display the number of columns selected? Matt Excel Discussion (Misc queries) 1 May 22nd 09 05:06 PM
SHADING OF SELECTED ROWS & COLUMNS DESJAL Excel Discussion (Misc queries) 1 December 14th 08 07:09 PM
How to printout only selected rows and columns Gina Meyer New Users to Excel 8 September 2nd 06 07:46 AM
Why does AutoFilter display rows NOT selected from drop down box? Jo M Excel Discussion (Misc queries) 9 October 15th 05 01:08 AM
Display selected rows from one worksheet to another Brian Excel Worksheet Functions 5 October 29th 04 12:26 PM


All times are GMT +1. The time now is 03:08 AM.

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"