Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default Issue with With statement

Similar to another post I had put up today, I am now trying to "With" to
qualify my statements. However, the code below gives me the "Run Time error
'1004': Application-defined or object defined error" error...any idea why?

With Sheets("Open Transactions")
.Range("D1").End(x1Down).Offset(1, 0).value = A.value
End With

--
Robert
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Issue with With statement

Copied your code into my own version and it doesn't appear to like having D1
or D2 empty. If these are empty using xldown sends it to Row 65536 (the
bottom) and then trying to move down 1 row (by the offset) takes it out of
the scope of the sheet.

If these Cells are populated do not get the error message.

"robs3131" wrote:

Similar to another post I had put up today, I am now trying to "With" to
qualify my statements. However, the code below gives me the "Run Time error
'1004': Application-defined or object defined error" error...any idea why?

With Sheets("Open Transactions")
.Range("D1").End(x1Down).Offset(1, 0).value = A.value
End With

--
Robert

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Issue with With statement

There is probably a more sophisticated way but using your same code logic

With Sheets("Open Transactions")
.Range("D65536").End(xlUp).Offset(1, 0).Value = A.Value
End With

This resolves your problem with having D1 or D2 blank. Note that this will
not work if anywere midway down Column D is populated.

"robs3131" wrote:

Similar to another post I had put up today, I am now trying to "With" to
qualify my statements. However, the code below gives me the "Run Time error
'1004': Application-defined or object defined error" error...any idea why?

With Sheets("Open Transactions")
.Range("D1").End(x1Down).Offset(1, 0).value = A.value
End With

--
Robert

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default Issue with With statement

Thanks David! I see now what the issue was. I think I'm just going to use
an If statement saying that if D1 / D2 are blank, then select the cell below.
If they are not blank, then I'll use the logic I originally wrote.
--
Robert


"David Messenger" wrote:

There is probably a more sophisticated way but using your same code logic

With Sheets("Open Transactions")
.Range("D65536").End(xlUp).Offset(1, 0).Value = A.Value
End With

This resolves your problem with having D1 or D2 blank. Note that this will
not work if anywere midway down Column D is populated.

"robs3131" wrote:

Similar to another post I had put up today, I am now trying to "With" to
qualify my statements. However, the code below gives me the "Run Time error
'1004': Application-defined or object defined error" error...any idea why?

With Sheets("Open Transactions")
.Range("D1").End(x1Down).Offset(1, 0).value = A.value
End With

--
Robert

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
IF statement inside a SUMIF statement.... or alternative method Sungibungi Excel Worksheet Functions 3 December 4th 09 06:22 PM
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
Date issue with if Statement Dewey Excel Programming 4 September 6th 06 02:18 PM
FOR Statement Issue G Excel Programming 2 September 9th 05 06:02 PM


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

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"