View Full Version : [SOLVED:] VBA to select cell in active row
TORPIDO
04-20-2020, 11:38 PM
hi all,
can someone help me with simple code
i need a code to select a cell range in active row;
thanks
Given .Cells(n) where n is a column number
ActiveCell.EntireRow.Cells(n).Select
TORPIDO
04-21-2020, 01:35 AM
thanks SamT,
so instead of entire row if i want to specify range A-E what needs to be changed there?
paulked
04-21-2020, 04:14 AM
Hi Torpido.
I don't want to sound rude, but this is a VBA Help Site, not a School.
There are thousands of tutorials out there on the web, I suggest you spend some time learning the basics of VBA.
There is also a Macro Recorder in Excel. Try that. Google is your buddy!
TORPIDO
04-21-2020, 04:37 AM
sorry but i dont have much use of VBA this is just small thing on my hand, nothing that i cant live without but it would be a help if this is done; Micro recorder... tried it, unfortunitly i dont have just a Row its whole sheet so do the math :crying::(
Btw google brought me here!:hi:
paulked
04-21-2020, 04:53 AM
Range("A" & ActiveCell.Row & ":E" & ActiveCell.Row).Select
ActiveCell.EntireRow.Range("A1:E1").Select
We Help. We Teach. We Guide. We Tutor. We Train. We Blog. We produce a Newsletter. We Consult. We produce videos. We hold Webinars. We provide complete integrated MS Office applications.
VBA Express is so much more than just a help forum.
http://www.vbaexpress.com/
http://www.vbaexpress.com/training.html
http://www.vbaexpress.com/excel-academy.html (http://www.vbaexpress.com/training.html)
https://www.youtube.com/user/VBAExpress/
.
paulked
04-21-2020, 06:53 AM
I stand corrected
TORPIDO
04-21-2020, 09:17 AM
thanks Paul, it worked like charm... mybe you motivate me to learn VB after all
:clap::clap:
also thanks SamT, kind words
paulked
04-21-2020, 09:53 AM
VBA is a very powerful tool to have in the toolbox, it is well worth the effort of learning it :thumb
TORPIDO
04-21-2020, 08:42 PM
hey Paul :hi:
just one more quick one, please
in above code, after selecting A to E, ive added to copy the selection, then i want it to go to select column F Next row
thanks
TORPIDO
04-21-2020, 08:50 PM
duplicate post
TORPIDO
04-21-2020, 08:57 PM
after selecting A to E, ive added to copy the selection, thereafter i want it to select Cell "F" of row below
jolivanes
04-22-2020, 11:37 AM
So maybe explain what you want to do, including the selecting A to E, which normally should not be required.
Some examples:
Range("F1:J1").Value = Range("A1:E1").Value
or
Cells(1, 1).Resize(, 5).Copy Cells(1, 6)
or
Cells(1, 6).Resize(, 5).Value = Cells(1, 1).Resize(,5).Value
and a lot other possibilities.
TORPIDO
04-23-2020, 10:40 AM
this worked
range("F" & ActiveCell.Row + 1).Select
thanks all
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.