Solved

Excel Column Selection Issue

Posted on 2002-03-24
16
137 Views
Last Modified: 2010-05-02
Hi all!

I have a question..

I recorded a macro that deletes the first column from a spreadsheet (its the last spreadsheet in the workbook).  I shift all the cells left.  Then I delete columns B thru G.  What I am after is the data in column 2 from the original columns.  It worked fine.  I then copied the code and put it behind a button.

Now, when I run this code, the first column selection selects columns A thru H.  I don't understand why it is doing that.

Can anyone help?

Thanks!!

ps.  Here is my code.

Columns("A:A").Select
    Selection.Delete Shift:=xlToLeft
    Columns("B:G").Select
    Selection.Delete Shift:=xlToLeft
    ActiveWindow.SmallScroll Down:=18
    Rows("37:38").Select
    Selection.Delete Shift:=xlUp
0
Comment
Question by:aubie8
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
  • 2
  • +1
16 Comments
 
LVL 44

Expert Comment

by:bruintje
ID: 6892264
Hi aubie8,

could you please provide some more info

the code as shown above is working, why it would select A thru H is not clear from this

-did you step thru your code?
-with F8 you can see what happens on every line of the code
-make sure to get both your workbook and VB Editor on your screen and with F8 debug the code
-i guess more is happening because the code should work as a standalone version

:O)Bruintje
0
 
LVL 44

Expert Comment

by:bruintje
ID: 6892265
is there more code working on this book?
0
 

Author Comment

by:aubie8
ID: 6893053
Thanks Bruintje.

Yes, I stepped through the code and what I described is still exactly what happens..

More info...

this is in a sub-procedure that is called by a userform.  up until that point, it seems to work correctly.  the code above is the first lines of code in the sub procedure.  there is more code below that that does things to the remaining data.  it doesn't work because there is no data, but when i do it manually and run the rest of the code, it works.

and, this worked last time i had the workbook open.  that was when i wrote it.

i would be glad to send the whole workbook if someone wanted to look at it.

chris
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 44

Expert Comment

by:bruintje
ID: 6893268
send it to valkovos@yahoo.com and i'll look at it
0
 
LVL 1

Expert Comment

by:inethog
ID: 6895369
If you don't mind, I would also like to have a look @ your code.

inethog@hotmail.com

Cheers.
0
 

Author Comment

by:aubie8
ID: 6925659
I just sent this weeks spreadsheet which is doing it again.

inethog@hotmail.com --> exceeded limit.

chris
0
 

Author Comment

by:aubie8
ID: 6925706
I just sent this weeks spreadsheet which is doing it again.

inethog@hotmail.com --> exceeded limit.

chris
0
 

Author Comment

by:aubie8
ID: 6926470
I just sent this weeks spreadsheet which is doing it again.

inethog@hotmail.com --> exceeded limit.

chris
0
 
LVL 44

Expert Comment

by:bruintje
ID: 6927267
Hi Chris i received it and will take a look at it and post here :O)Bruintje
0
 

Author Comment

by:aubie8
ID: 7465528
how do i close this question?

i figured out the issue on my own.

chris
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7465548
hmm i certainly didn't follow up here...

can you post your solution i can sign in a moderator to refund your points and place this in the PAQ

thanks
:O)Bruintje
0
 

Accepted Solution

by:
Jgould earned 0 total points
ID: 7465556
Dear aubie8,

Will refund your points on this and move this to PAQ, as bruintje requested could you post your solution? if not then i will delete the question later

Thank you

Jgould-EE Moderator
0
 

Author Comment

by:aubie8
ID: 7465771
how do i close this question?

i figured out the issue on my own.

chris
0
 

Expert Comment

by:Jgould
ID: 7465781
Chris it's already closed and you have your points back, if you post your solution here i will leave it in the previous asked questions or else i will delete it

just leave a comment

thank you
Jgould-EE Moderator
0
 

Author Comment

by:aubie8
ID: 7465783
sure, i will post the solution..  i will have to go look it up again.  basically, i was just using some wrong methods i think.

chris
0
 

Author Comment

by:aubie8
ID: 7465785
and my main reason to close this was not the points but so that people wouldn't think i didn't follow through with awarding points when people work hard on a question for you.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question