Solved

Excel Column Selection Issue

Posted on 2002-03-24
16
135 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
  • 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

860 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