PC Review


Reply
Thread Tools Rate Thread

Change code by code. Can you do that?

 
 
Corey
Guest
Posts: n/a
 
      1st Mar 2007
LastCell = Worksheets("Main").Cells(Rows.Count, "B").End(xlUp).Row ' CHANGE COLUMN (B) TO (D) FOR
YEAR-2008

With the above line of code,
If the date which is input (Now, Format "mmmm yy") into sheet1.range("C16") when the workbook opens
the year changes from 2007 to 2008,
then the above code line "B" changes to "D".


Can vb do this?

Corey.....


 
Reply With Quote
 
 
 
 
merjet
Guest
Posts: n/a
 
      1st Mar 2007
iYr = Year(Sheets("Sheet1").Range("C16")
If iYr = 2007 Then aCol = "B"
If iYr = 2008 Then aCol = "D"
LastCell = Worksheets("Main").Cells(Rows.Count, aCol).End(xlUp).Row

Merjet


 
Reply With Quote
 
Corey
Guest
Posts: n/a
 
      1st Mar 2007
Thank you Merjet



"merjet" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
iYr = Year(Sheets("Sheet1").Range("C16")
If iYr = 2007 Then aCol = "B"
If iYr = 2008 Then aCol = "D"
LastCell = Worksheets("Main").Cells(Rows.Count, aCol).End(xlUp).Row

Merjet



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change abbreviated code to its code description Jewel Microsoft Access Getting Started 2 5th Feb 2009 10:33 PM
Run VBA code only worksheet change, but don't trigger worksheet_change event based on what the code does ker_01 Microsoft Excel Programming 6 3rd Oct 2008 09:45 PM
Code to change code in a sheet and workbook module Otto Moehrbach Microsoft Excel Programming 11 11th Nov 2007 07:20 PM
[New] Zipoid - ZIP Code, City Name and Area Code Lookup - Zip Code to Zip Code Distance Calculation Mel Freeware 0 22nd Jul 2005 04:13 PM
how do I dynamically change an html meta tag from my code behind code? ntm Microsoft ASP .NET 2 19th Jan 2004 05:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:38 PM.