Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA to copy sheets (as values) that begin with the same sheet name

Experienced in Excel, but I am just learning VBA.

I want the macro to call a combo box and then select all sheets that start
with the value in the combo. Then, it needs to copy the selected sheets (as
values) to a new workbook.
--
Thanks,
Brent
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default VBA to copy sheets (as values) that begin with the same sheet name

Assuming Sheet1 has the ComboBox:

Sub Test()
Dim ws As Worksheet, fFound As Boolean
fFound = True
For Each ws In Worksheets
If Left(ws.Name, Len(Sheet1.ComboBox1)) = Sheet1.ComboBox1 Then
ws.Select fFound
fFound = False
End If
Next
ActiveWindow.SelectedSheets.Copy
End Sub

Not sure what you mean by wanting a macro to call a combo box.

--

Vasant





"Brent Walker" wrote in message
...
Experienced in Excel, but I am just learning VBA.

I want the macro to call a combo box and then select all sheets that start
with the value in the combo. Then, it needs to copy the selected sheets

(as
values) to a new workbook.
--
Thanks,
Brent



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA to copy sheets (as values) that begin with the same sheet

Thanks. This is helpful.

When I said I want the macro to call a combo box, I meant that I want the
macro to call a form that contains a combo box. Any way to do that?

"Vasant Nanavati" wrote:

Assuming Sheet1 has the ComboBox:

Sub Test()
Dim ws As Worksheet, fFound As Boolean
fFound = True
For Each ws In Worksheets
If Left(ws.Name, Len(Sheet1.ComboBox1)) = Sheet1.ComboBox1 Then
ws.Select fFound
fFound = False
End If
Next
ActiveWindow.SelectedSheets.Copy
End Sub

Not sure what you mean by wanting a macro to call a combo box.

--

Vasant





"Brent Walker" wrote in message
...
Experienced in Excel, but I am just learning VBA.

I want the macro to call a combo box and then select all sheets that start
with the value in the combo. Then, it needs to copy the selected sheets

(as
values) to a new workbook.
--
Thanks,
Brent




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default VBA to copy sheets (as values) that begin with the same sheet

UserForm1.Show

--

Vasant

"Brent Walker" wrote in message
...
Thanks. This is helpful.

When I said I want the macro to call a combo box, I meant that I want the
macro to call a form that contains a combo box. Any way to do that?

"Vasant Nanavati" wrote:

Assuming Sheet1 has the ComboBox:

Sub Test()
Dim ws As Worksheet, fFound As Boolean
fFound = True
For Each ws In Worksheets
If Left(ws.Name, Len(Sheet1.ComboBox1)) = Sheet1.ComboBox1 Then
ws.Select fFound
fFound = False
End If
Next
ActiveWindow.SelectedSheets.Copy
End Sub

Not sure what you mean by wanting a macro to call a combo box.

--

Vasant





"Brent Walker" wrote in message
...
Experienced in Excel, but I am just learning VBA.

I want the macro to call a combo box and then select all sheets that

start
with the value in the combo. Then, it needs to copy the selected

sheets
(as
values) to a new workbook.
--
Thanks,
Brent






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA to copy sheets (as values) that begin with the same sheet

Thanks. This works like a champ.

Is there any way to get it to paste the cells in the sheets as values
instead of formulas? I need to be able to email the copied workbooks and do
not want any linking errors confusing anyone.




"Vasant Nanavati" wrote:

UserForm1.Show

--

Vasant

"Brent Walker" wrote in message
...
Thanks. This is helpful.

When I said I want the macro to call a combo box, I meant that I want the
macro to call a form that contains a combo box. Any way to do that?

"Vasant Nanavati" wrote:

Assuming Sheet1 has the ComboBox:

Sub Test()
Dim ws As Worksheet, fFound As Boolean
fFound = True
For Each ws In Worksheets
If Left(ws.Name, Len(Sheet1.ComboBox1)) = Sheet1.ComboBox1 Then
ws.Select fFound
fFound = False
End If
Next
ActiveWindow.SelectedSheets.Copy
End Sub

Not sure what you mean by wanting a macro to call a combo box.

--

Vasant





"Brent Walker" wrote in message
...
Experienced in Excel, but I am just learning VBA.

I want the macro to call a combo box and then select all sheets that

start
with the value in the combo. Then, it needs to copy the selected

sheets
(as
values) to a new workbook.
--
Thanks,
Brent








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default VBA to copy sheets (as values) that begin with the same sheet

Selection.PasteSpecial Paste:=xlPasteValues, Transpose:=False

"Brent Walker" wrote:

Thanks. This works like a champ.

Is there any way to get it to paste the cells in the sheets as values
instead of formulas? I need to be able to email the copied workbooks and do
not want any linking errors confusing anyone.




"Vasant Nanavati" wrote:

UserForm1.Show

--

Vasant

"Brent Walker" wrote in message
...
Thanks. This is helpful.

When I said I want the macro to call a combo box, I meant that I want the
macro to call a form that contains a combo box. Any way to do that?

"Vasant Nanavati" wrote:

Assuming Sheet1 has the ComboBox:

Sub Test()
Dim ws As Worksheet, fFound As Boolean
fFound = True
For Each ws In Worksheets
If Left(ws.Name, Len(Sheet1.ComboBox1)) = Sheet1.ComboBox1 Then
ws.Select fFound
fFound = False
End If
Next
ActiveWindow.SelectedSheets.Copy
End Sub

Not sure what you mean by wanting a macro to call a combo box.

--

Vasant





"Brent Walker" wrote in message
...
Experienced in Excel, but I am just learning VBA.

I want the macro to call a combo box and then select all sheets that

start
with the value in the combo. Then, it needs to copy the selected

sheets
(as
values) to a new workbook.
--
Thanks,
Brent






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
Copy Sheet to new Sheet and clear cells on original sheets Boiler-Todd Excel Discussion (Misc queries) 7 September 23rd 09 10:02 PM
copy values generated by conditional formula in one sheet to the other work sheet as values ramana Excel Worksheet Functions 1 October 5th 05 01:04 PM
copy values generated by conditional formula in one sheet to the other work sheet as values bobby Excel Discussion (Misc queries) 1 October 5th 05 12:18 PM
in VBA Sheets("mysheet").Copy Befo=Sheets(1) how do i get a reference to the newly created copy of this sheet? Daniel Excel Worksheet Functions 1 July 6th 05 09:57 PM
How do i compare values from two sheet and copy & paste if values match? rozb Excel Programming 0 March 5th 04 12:06 AM


All times are GMT +1. The time now is 05:19 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"