Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Change code by code. Can you do that?

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.....


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Change code by code. Can you do that?

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Change code by code. Can you do that?

Thank you Merjet



"merjet" wrote in message
oups.com...
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
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 change this code? OrlaLynch Excel Discussion (Misc queries) 1 June 11th 08 03:06 PM
Can I use code/macro to change code/macro in an existing file? Scott Bedows Excel Programming 2 February 14th 07 05:50 AM
change code keri Excel Programming 2 December 20th 06 12:47 PM
Code Conflicts With Worksheet Change Code Paige Excel Programming 3 March 3rd 06 04:25 PM
VB CODE RUN ON DDE VALUE CHANGE Frank Kabel Excel Programming 1 April 1st 04 08:31 PM


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