Wrox Programmer Forums
|
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 2nd, 2009, 05:41 AM
Authorized User
 
Join Date: Mar 2006
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default Nested if in VB

Morning bro and sis, How should I code, to copy base on current month....anybody ?

Regards...


Sub Transform()

----> Proceed this statement when month = October
Sheets("Chart 2009").Select
Range("H35:H38").Select
Selection.Copy
Sheets("Year 2009").Select
Range("K4:K7").Select
ActiveSheet.Paste

---> Proceed this statement when month = November
Sheets("Chart 2009").Select
Range("J35:J38").Select
Selection.Copy
Sheets("Year 2009").Select
Range("L4:L7").Select
ActiveSheet.Paste

---> Proceed this statement when month = December
Sheets("Chart 2009").Select
Range("H35:H38").Select
Selection.Copy
Sheets("Year 2009").Select
Range("M4:M7").Select
ActiveSheet.Paste

End Sub
Reply With Quote
  #2 (permalink)  
Old October 2nd, 2009, 09:21 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Arrow

If you want to write some code based on current month, then you can do something like:

Code:
select case month(Date) 
case 10
 'Write code specific to October month
 Response.Write "October"
case 11
 'Write code specific to November month
 Response.Write "November"
case 12
 'Write code specific to December month
 Response.Write "December"
end select
__________________
Om Prakash Pant
Click the "Thanks" button if this post helped you.
Reply With Quote
  #3 (permalink)  
Old October 5th, 2009, 12:47 AM
Authorized User
 
Join Date: Mar 2006
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Mr. Prakash, I did it refer to your kind advice...: )
Reply With Quote
  #4 (permalink)  
Old October 6th, 2009, 12:34 AM
Authorized User
 
Join Date: Mar 2006
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default Copy range excluding cell format

Morning bro and sis,

I want to copy range excluding cell format I need only cell value, anybody ? I tried with code below but the result pasted with cells format.

Sheets("WK01").Select
Range("B36:B36").Select
Selection.Copy
Sheets("WK02").Select
Range("B5:B5").Select
ActiveSheet.Paste

Regards...
Reply With Quote
  #5 (permalink)  
Old October 9th, 2009, 04:27 AM
Authorized User
 
Join Date: Mar 2006
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Wenggo View Post
Morning bro and sis,

I want to copy range excluding cell format I need only cell value, anybody ? I tried with code below but the result pasted with cells format.

Sheets("WK01").Select
Range("B36:B36").Select
Selection.Copy
Sheets("WK02").Select
Range("B5:B5").Select
ActiveSheet.Paste

Regards...
Anybody had any idea for this case ?
Reply With Quote
  #6 (permalink)  
Old October 28th, 2009, 04:07 AM
Registered User
 
Join Date: Oct 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try Selection.PasteSpecial Paste:=xlPasteValues
Reply With Quote
  #7 (permalink)  
Old November 11th, 2009, 03:29 AM
Authorized User
 
Join Date: Mar 2006
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks blueblade, for your help and problem solved.

Can anybody give any web address best tutorial@samples for beginner like me to learn Excel macros programming. (VBScript)

Regards...
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
nested for hastikeyvan Classic ASP Professional 1 July 27th, 2006 06:28 PM
nested for-each sassymonix XSLT 6 May 16th, 2006 06:47 AM
Nested Exceptions in c# JelfMaria VS.NET 2002/2003 5 June 28th, 2005 01:15 AM
Nested If pans Access 4 December 10th, 2004 12:39 AM
Nested Group sefrank SQL Server 2000 2 October 12th, 2003 12:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.