Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default If then statement causing value issues in Macros

I have three sheets in my workbook for journal upload form.

Sheet Ldr Jrnl Entry is the users journal data input
Sheet GL Upload is the Financial ERP system upload file
Sheet Actions is the macro buttons to fire off the VB macros

For GL Upload Sheet there is an accrual field and when this is blank it must
be removed before uploading.

I created this simple VB statement

Sheets("GL Upload").Columns("T:T").Delete Shift:=xlToLeft

The problem is that if the users have an accrual I do not want to have them
delete this field.

So I thought if the field is 1/01/1900 then do this:

If Sheets("GL Upload").Columns("T:T").Value = "01/01/1900" Then
Sheets("GL Upload").Columns("T:T").Delete Shift:=xlToLeft
End If

My problem is that Column T references Sheet Ldr Jrnl Entry. If you click
any row on Column T you see this ='Ldr Jrnl Entry'!AT12 and not 01/01/1900.
01/01/1900 only shows because of cell formatting.

I keep getting a type mismatch error when running the If then macro..

I am novice at best at VB and needs to guidance to how to 'trick' the
referenced cell to be some type of value...





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default If then statement causing value issues in Macros

Hi,
what about comparing with the Text property of the cell instead of the Value
property?
If Sheets("GL Upload").Columns("T:T").Text = "01/01/1900"

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"ssciarrino" wrote:

I have three sheets in my workbook for journal upload form.

Sheet Ldr Jrnl Entry is the users journal data input
Sheet GL Upload is the Financial ERP system upload file
Sheet Actions is the macro buttons to fire off the VB macros

For GL Upload Sheet there is an accrual field and when this is blank it must
be removed before uploading.

I created this simple VB statement

Sheets("GL Upload").Columns("T:T").Delete Shift:=xlToLeft

The problem is that if the users have an accrual I do not want to have them
delete this field.

So I thought if the field is 1/01/1900 then do this:

If Sheets("GL Upload").Columns("T:T").Value = "01/01/1900" Then
Sheets("GL Upload").Columns("T:T").Delete Shift:=xlToLeft
End If

My problem is that Column T references Sheet Ldr Jrnl Entry. If you click
any row on Column T you see this ='Ldr Jrnl Entry'!AT12 and not 01/01/1900.
01/01/1900 only shows because of cell formatting.

I keep getting a type mismatch error when running the If then macro..

I am novice at best at VB and needs to guidance to how to 'trick' the
referenced cell to be some type of value...





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default If then statement causing value issues in Macros

Sebastienm,

Thanks for the heads up...well the good news...it didn't bomb with an error
but running it does nothing..the column still exists...

is there another value besides text, i.e. cell format or something that
could achieve what I am looking for?

"sebastienm" wrote:

Hi,
what about comparing with the Text property of the cell instead of the Value
property?
If Sheets("GL Upload").Columns("T:T").Text = "01/01/1900"

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"ssciarrino" wrote:

I have three sheets in my workbook for journal upload form.

Sheet Ldr Jrnl Entry is the users journal data input
Sheet GL Upload is the Financial ERP system upload file
Sheet Actions is the macro buttons to fire off the VB macros

For GL Upload Sheet there is an accrual field and when this is blank it must
be removed before uploading.

I created this simple VB statement

Sheets("GL Upload").Columns("T:T").Delete Shift:=xlToLeft

The problem is that if the users have an accrual I do not want to have them
delete this field.

So I thought if the field is 1/01/1900 then do this:

If Sheets("GL Upload").Columns("T:T").Value = "01/01/1900" Then
Sheets("GL Upload").Columns("T:T").Delete Shift:=xlToLeft
End If

My problem is that Column T references Sheet Ldr Jrnl Entry. If you click
any row on Column T you see this ='Ldr Jrnl Entry'!AT12 and not 01/01/1900.
01/01/1900 only shows because of cell formatting.

I keep getting a type mismatch error when running the If then macro..

I am novice at best at VB and needs to guidance to how to 'trick' the
referenced cell to be some type of value...





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
Phantom Objects causing issues peterpeter Excel Discussion (Misc queries) 4 December 3rd 07 12:54 PM
xls spreadsheet constantly calculating causing navigation issues Matabi Excel Worksheet Functions 1 March 15th 06 12:10 PM
causing macros to run at insertion point Inobugs Excel Worksheet Functions 3 February 1st 06 06:19 AM
INSERT INTO sql statement causing error Michael Malinsky[_2_] Excel Programming 1 September 21st 05 08:07 PM
excel 2000 add-in causing delay issues jamesd3rd Excel Programming 0 May 11th 04 09:22 PM


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