Solved

Excel Column Selection Issue

Posted on 2002-03-24
16
132 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code 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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now