Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Unselect Cells


I need to unselect the cells in the new worksheet (in new workbook) tha
I'm creating.

I can't seem to figure out how to unselect the cells from the ne
worksheet file that I'm creating. This is the part of my macro tha
creates a separate copy of my current activesheet. The Problem is whe
the Macro creates the new sheet it leaves all the cells selected s
when I open the file again they are all selected. How do I unselect th
sheet prior to the sheet saving?

Dim FileName As String
FileName = "C:\test5\" & Range("C105") & " " & Range("f105")

ActiveSheet.Copy
With ActiveWorkbook
.Sheets(1).Cells.Copy
.Sheets(1).Cells.PasteSpecial (xlPasteValues)
.SaveAs FileName
.Close
End Wit

--
bobwilso
-----------------------------------------------------------------------
bobwilson's Profile: http://www.excelforum.com/member.php...fo&userid=3304
View this thread: http://www.excelforum.com/showthread.php?threadid=52921

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Unselect Cells

Something needs to be selected. Try something like this...

With ActiveWorkbook
..Sheets(1).Cells.Copy
..Sheets(1).Cells.PasteSpecial (xlPasteValues)
..Sheets(1).Range("A1").Select
..SaveAs FileName
..Close
End With

--
HTH...

Jim Thomlinson


"bobwilson" wrote:


I need to unselect the cells in the new worksheet (in new workbook) that
I'm creating.

I can't seem to figure out how to unselect the cells from the new
worksheet file that I'm creating. This is the part of my macro that
creates a separate copy of my current activesheet. The Problem is when
the Macro creates the new sheet it leaves all the cells selected so
when I open the file again they are all selected. How do I unselect the
sheet prior to the sheet saving?

Dim FileName As String
FileName = "C:\test5\" & Range("C105") & " " & Range("f105")

ActiveSheet.Copy
With ActiveWorkbook
.Sheets(1).Cells.Copy
.Sheets(1).Cells.PasteSpecial (xlPasteValues)
.SaveAs FileName
.Close
End With


--
bobwilson
------------------------------------------------------------------------
bobwilson's Profile: http://www.excelforum.com/member.php...o&userid=33046
View this thread: http://www.excelforum.com/showthread...hreadid=529212


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Unselect Cells

Dim FileName As String
FileName = "C:\test5\" & Range("C105") & " " & Range("f105")

ActiveSheet.Copy
With ActiveWorkbook
.Sheets(1).Cells.Copy
.Sheets(1).Cells.PasteSpecial (xlPasteValues)
.Range("A1").Select
.SaveAs FileName
.Close
End With

--
Regards,
Tom Ogilvy


"bobwilson" wrote:


I need to unselect the cells in the new worksheet (in new workbook) that
I'm creating.

I can't seem to figure out how to unselect the cells from the new
worksheet file that I'm creating. This is the part of my macro that
creates a separate copy of my current activesheet. The Problem is when
the Macro creates the new sheet it leaves all the cells selected so
when I open the file again they are all selected. How do I unselect the
sheet prior to the sheet saving?

Dim FileName As String
FileName = "C:\test5\" & Range("C105") & " " & Range("f105")

ActiveSheet.Copy
With ActiveWorkbook
.Sheets(1).Cells.Copy
.Sheets(1).Cells.PasteSpecial (xlPasteValues)
.SaveAs FileName
.Close
End With


--
bobwilson
------------------------------------------------------------------------
bobwilson's Profile: http://www.excelforum.com/member.php...o&userid=33046
View this thread: http://www.excelforum.com/showthread...hreadid=529212


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Unselect Cells

typo:

ActiveSheet.Copy
With ActiveWorkbook
.Sheets(1).Cells.Copy
.Sheets(1).Cells.PasteSpecial (xlPasteValues)
.Sheets(1).Range("A1").Select
.SaveAs FileName
.Close
End With

or

ActiveSheet.Copy
With ActiveWorkbook.sheets(1)
.Cells.Copy
.Cells.PasteSpecial (xlPasteValues)
.Range("A1").Select
.Parent.SaveAs FileName
.Parent.Close SaveChanges:=False
End With

--
Regards,
Tom Ogilvy

--
Regards,
Tom Ogilvy



"Tom Ogilvy" wrote:

Dim FileName As String
FileName = "C:\test5\" & Range("C105") & " " & Range("f105")

ActiveSheet.Copy
With ActiveWorkbook
.Sheets(1).Cells.Copy
.Sheets(1).Cells.PasteSpecial (xlPasteValues)
.Range("A1").Select
.SaveAs FileName
.Close
End With

--
Regards,
Tom Ogilvy


"bobwilson" wrote:


I need to unselect the cells in the new worksheet (in new workbook) that
I'm creating.

I can't seem to figure out how to unselect the cells from the new
worksheet file that I'm creating. This is the part of my macro that
creates a separate copy of my current activesheet. The Problem is when
the Macro creates the new sheet it leaves all the cells selected so
when I open the file again they are all selected. How do I unselect the
sheet prior to the sheet saving?

Dim FileName As String
FileName = "C:\test5\" & Range("C105") & " " & Range("f105")

ActiveSheet.Copy
With ActiveWorkbook
.Sheets(1).Cells.Copy
.Sheets(1).Cells.PasteSpecial (xlPasteValues)
.SaveAs FileName
.Close
End With


--
bobwilson
------------------------------------------------------------------------
bobwilson's Profile: http://www.excelforum.com/member.php...o&userid=33046
View this thread: http://www.excelforum.com/showthread...hreadid=529212


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Unselect Cells


Thanks Tom - That works

What is the difference between the two types of code you provided?
assume it does the same thing. I'm just trying to better understan
VBA.

Bo

--
bobwilso
-----------------------------------------------------------------------
bobwilson's Profile: http://www.excelforum.com/member.php...fo&userid=3304
View this thread: http://www.excelforum.com/showthread.php?threadid=52921



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Unselect Cells

No real difference. The technical difference is how much of the reference I
put in the With statement and how much was repeated in the code between the
if statements. In your case, you had about as many lines referring to
Workbook actions as you did to sheet actions. So not much difference.

--
Regards,
Tom Ogilvy

"bobwilson" wrote
in message ...

Thanks Tom - That works

What is the difference between the two types of code you provided? I
assume it does the same thing. I'm just trying to better understand
VBA.

Bob


--
bobwilson
------------------------------------------------------------------------
bobwilson's Profile:

http://www.excelforum.com/member.php...o&userid=33046
View this thread: http://www.excelforum.com/showthread...hreadid=529212



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Unselect Cells

Hi
Park the cursor somewhe

ActiveSheet.Copy
With ActiveWorkbook
With .Sheets(1)
.Cells.Copy
.Cells.PasteSpecial (xlPasteValues)
.Activate
.cells(1,1).Select
End With
..SaveAs FileName
..Close
End With

This is untested.

regards
Paul

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
Deselect (Unselect) Cells gtabmx Excel Discussion (Misc queries) 15 January 6th 10 02:13 PM
unselect cells tgi Excel Discussion (Misc queries) 1 October 1st 09 03:21 AM
unselect cells tgi Excel Discussion (Misc queries) 2 October 1st 09 01:39 AM
How to unselect? Kou Vang[_2_] Excel Programming 3 January 26th 06 02:54 PM
Unselect range Biff Excel Programming 8 September 30th 05 09:31 PM


All times are GMT +1. The time now is 02:06 AM.

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

About Us

"It's about Microsoft Excel"