Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default I dont understand why this happens

I want to cut column 2, the variable is holding the value 2 but the column 3
is the one selected. This problem is unpredictiable because the selected
column can be different. What is happening here and how do I fix it?

--
Scott A. Cooper


"Cooper, Scott A." wrote:

In the following code, columns are correctly identified with debug.print but
the wrong columns are selected when the Find function is embedded like the
second block of code. Can someone explain what is going on here?

' Code Block 1:
Debug.Print .Find("Part Number").Column
Debug.Print .Find("Product").Column
Debug.Print .Find("Cat").Column
Debug.Print .Find("Ext Qty").Column
Debug.Print .Find("List Price").Column
Debug.Print .Find("Service Months").Column

' Code Block 2:
.Columns(.Find("Part Number").Column).Cut
oNewWrk.Columns(1).Insert
.Columns(.Find("Product").Column).Cut
oNewWrk.Columns(2).Insert
.Columns(.Find("Cat").Column).Cut
oNewWrk.Columns(3).Insert
.Columns(.Find("Ext Qty").Column).Cut
oNewWrk.Columns(4).Insert
.Columns(.Find("List Price").Column).Cut
oNewWrk.Columns(5).Insert
.Columns(.Find("Service Months").Column).Cut
oNewWrk.Columns(6).Insert

--
Scott A. Cooper

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
Gap or something I cannot understand MFS Excel Discussion (Misc queries) 1 August 26th 09 12:13 AM
Select case statement - it will not work and i dont understand why! :o( Thomas[_19_] Excel Programming 3 September 26th 05 05:14 PM
dont understand compile error N E Body[_19_] Excel Programming 4 November 26th 04 05:08 PM
<> Scooterdog Excel Worksheet Functions 1 November 8th 04 07:56 AM
I dont understand.... TOM Excel Programming 4 July 8th 04 02:49 PM


All times are GMT +1. The time now is 07:20 AM.

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"