aubie8
asked on
Excel Column Selection Issue
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
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
is there more code working on this book?
ASKER
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
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
send it to valkovos@yahoo.com and i'll look at it
If you don't mind, I would also like to have a look @ your code.
inethog@hotmail.com
Cheers.
inethog@hotmail.com
Cheers.
ASKER
I just sent this weeks spreadsheet which is doing it again.
inethog@hotmail.com --> exceeded limit.
chris
inethog@hotmail.com --> exceeded limit.
chris
ASKER
I just sent this weeks spreadsheet which is doing it again.
inethog@hotmail.com --> exceeded limit.
chris
inethog@hotmail.com --> exceeded limit.
chris
ASKER
I just sent this weeks spreadsheet which is doing it again.
inethog@hotmail.com --> exceeded limit.
chris
inethog@hotmail.com --> exceeded limit.
chris
Hi Chris i received it and will take a look at it and post here :O)Bruintje
ASKER
how do i close this question?
i figured out the issue on my own.
chris
i figured out the issue on my own.
chris
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
can you post your solution i can sign in a moderator to refund your points and place this in the PAQ
thanks
:O)Bruintje
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
how do i close this question?
i figured out the issue on my own.
chris
i figured out the issue on my own.
chris
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
just leave a comment
thank you
Jgould-EE Moderator
ASKER
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
chris
ASKER
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.
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