Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: excel vba programming code

03 Sep 2014   #1
marthijn99

Windows 8.1 x64
 
 
excel vba programming code

when i try to make an vba code in excel vba extension at the moment i added
this line to the code of a button:

Range("A1").End(xlDown).Offset(1, 0).Select


it says there is an error but i did exactly what they said on this video
https://www.youtube.com/watch?v=CzP8nO9UVvY
its explained just after 25:12 minutes


My System SpecsSystem Spec
.
03 Sep 2014   #2
Tookeri

Windows 7 Pro 32
 
 

I tried the code and it works without errors. Are you sure it's that line it complains about?

This shorter one works to: Range("A1").End(xlDown).Select
My System SpecsSystem Spec
03 Sep 2014   #3
marthijn99

Windows 8.1 x64
 
 

Quote   Quote: Originally Posted by Tookeri View Post
I tried the code and it works without errors. Are you sure it's that line it complains about?

This shorter one works to: Range("A1").End(xlDown).Select

can it be because of spaces before it intstead of langspaces (like when you use tab)

okay with the short one it works just fine
My System SpecsSystem Spec
.

03 Sep 2014   #4
Tookeri

Windows 7 Pro 32
 
 

Great! Please mark the thread as solved
My System SpecsSystem Spec
03 Sep 2014   #5
strollin

W10 Pro desktop, W10 laptop, W10 laptop, W10 Pro tablet (all 64-bit)
 
 

The short version doesn't do the same thing as the long version. The short version selects the last value in column A while the long version selects the next empty cell after the last value in column A. (This assumes there are no empty cells in column A as it will stop on the first empty cell)

The code works for me but you have to make sure that you are running it against a sheet that has at least one value in column A. If you run it against a column that has no values in it then it will fail because it will go to the last row in column A and then try to go to 1 row down which causes it to fail.
My System SpecsSystem Spec
03 Sep 2014   #6
Tookeri

Windows 7 Pro 32
 
 

Good points! If the short version produces a logical error, that may be even worse than a real one. Thanks!
My System SpecsSystem Spec
03 Sep 2014   #7
marthijn99

Windows 8.1 x64
 
 

Quote   Quote: Originally Posted by Tookeri View Post
Good points! If the short version produces a logical error, that may be even worse than a real one. Thanks!
so do i makr it as solved already or can i aks more questions in this one

(next question is: how do i solve this error ? with the short code it does like alraedy said by someone else it goes to the verry last colmn and with the long one it does this error(shown below but when i click debug it shows me the code (Range("A1").End(xlDown).Offset(1, 0).Select) is wrong


Attached Thumbnails
excel vba programming code-naamloos.png  
My System SpecsSystem Spec
03 Sep 2014   #8
Tookeri

Windows 7 Pro 32
 
 

You can ask how many questions you want

If you want the next empty cell you can try the shorter version that doesn't produce an error. And then move one cell down and see if that works:

Range("A1").End(xlDown).Select
ActiveCell.Offset(1, 0).Select 'move one cell down
My System SpecsSystem Spec
03 Sep 2014   #9
strollin

W10 Pro desktop, W10 laptop, W10 laptop, W10 Pro tablet (all 64-bit)
 
 

We would need to see what the spreadsheet looks like and what column is "Cell1".
My System SpecsSystem Spec
03 Sep 2014   #10
marthijn99

Windows 8.1 x64
 
 

Quote   Quote: Originally Posted by Tookeri View Post
You can ask how many questions you want

If you want the next empty cell you can try the shorter version that doesn't produce an error. And then move one cell down and see if that works:

Range("A1").End(xlDown).Select
ActiveCell.Offset(1, 0).Select 'move one cell down
Quote   Quote: Originally Posted by strollin View Post
We would need to see what the spreadsheet looks like and what column is "Cell1".
okay now i have an error message at: ActiveCell.Offset(1, 0).Select

+ here are the screen shots of what i think are the spread sheets ( sorry i dont know engish verry well )


Attached Thumbnails
excel vba programming code-naamloos1.png   excel vba programming code-naamloos2.png  
My System SpecsSystem Spec
Reply

 excel vba programming code




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
C++ Programming
Thanks to the creators of Seven Forums (: I'm currently learning C++ programming, and this forum has really helped me develop my general knowledge of computing. Is there any C++ programming threads?
Chillout Room
Programming
Hi guys, I have a desire to learn how to program, i have absolutely no experience whatsoever. I am 45 years old (Please tell me i'm not to old), i enjoy working in microsoft office so i presume visual basics is what i need to learn. Access is what i'm perticularly interested in learning,...
Chillout Room
Formatting Excel 2010, Excel 2003
Hello, I want to create a table as in the drawing below, where the first cell is table-wide (as it contains the heading common (pertaining?) to all columns and rows under it) but, and this is where I cannot get it together, where those cells are divided into several columns. It's a cinch when...
Microsoft Office
Programming Help - Please!
Hey Guys, I'm trying to create a personal website for my new born daughter. I have a few ideas/thoughts in mind on how I want it to act and function. I already purchased the domain name & beginning to work on a few stuff. I need some programming help making the site "e-mail access only", meaning...
Chillout Room
Can't open 2003 Excel Files in Excel 2007?
I'm not sure if it because the files are 2003 or not? When I try to open them an error message appears stating, "...the file you are trying to open is in a different format than specified by the file extension. Verify file is not corrupted and is from a trusted source..." These are my files. The...
Microsoft Office
Excel 2003 - Multiple Excel Open
Hi All, I don't know if I'm posting in the right area but I really need help. Before (In XP and Vista), when I have one excel file open and I go to desktop to open a different excel, it would open in the same excel program (2 files in 1 program) With Windows 7, when I open a different file, it...
Microsoft Office


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 17:34.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App