Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi all,
How to code: If rownumber 1 and rownumber < 43 And an entire row is selected Then .... The first part is no problem, but I don't know what to do with "And an entire row is selected " Your help will be appreciated. Jack Sons The Netherlands |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
first check that only one row is selected:
MsgBox (Selection.Rows.Count) and then check that the entire row is selected: MsgBox (Selection.Count) for a complete single row, the first should be 1 and the second should be 256 -- Gary's Student "Jack Sons" wrote: Hi all, How to code: If rownumber 1 and rownumber < 43 And an entire row is selected Then .... The first part is no problem, but I don't know what to do with "And an entire row is selected " Your help will be appreciated. Jack Sons The Netherlands |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
GS,
Thank you, but I don't want a message box to appear. Depending on wether an entire row is selected or only one cell or a limited group of cells, I will let something happen. I just need to know in that part of the code what in the sheet is selected, an entire row or something else. Jack. "Gary''s Student" schreef in bericht ... first check that only one row is selected: MsgBox (Selection.Rows.Count) and then check that the entire row is selected: MsgBox (Selection.Count) for a complete single row, the first should be 1 and the second should be 256 -- Gary's Student "Jack Sons" wrote: Hi all, How to code: If rownumber 1 and rownumber < 43 And an entire row is selected Then .... The first part is no problem, but I don't know what to do with "And an entire row is selected " Your help will be appreciated. Jack Sons The Netherlands |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub JackSons()
Dim rownumber As Long rownumber = ActiveCell.Row If rownumber 1 And rownumber < 43 And _ Selection.Columns.Count = ActiveSheet.Columns.Count Then 'your code End If End Sub -- HTH Bob Phillips (replace xxxx in the email address with gmail if mailing direct) "Jack Sons" wrote in message ... GS, Thank you, but I don't want a message box to appear. Depending on wether an entire row is selected or only one cell or a limited group of cells, I will let something happen. I just need to know in that part of the code what in the sheet is selected, an entire row or something else. Jack. "Gary''s Student" schreef in bericht ... first check that only one row is selected: MsgBox (Selection.Rows.Count) and then check that the entire row is selected: MsgBox (Selection.Count) for a complete single row, the first should be 1 and the second should be 256 -- Gary's Student "Jack Sons" wrote: Hi all, How to code: If rownumber 1 and rownumber < 43 And an entire row is selected Then .... The first part is no problem, but I don't know what to do with "And an entire row is selected " Your help will be appreciated. Jack Sons The Netherlands |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
if selection.address = activecell.entirerow.address then
'single row selected else 'not a single row end if Jack Sons wrote: Hi all, How to code: If rownumber 1 and rownumber < 43 And an entire row is selected Then .... The first part is no problem, but I don't know what to do with "And an entire row is selected " Your help will be appreciated. Jack Sons The Netherlands -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Bob and Dave,
Thank you very much, would never have found this code myself. Jack. "Jack Sons" schreef in bericht ... Hi all, How to code: If rownumber 1 and rownumber < 43 And an entire row is selected Then .... The first part is no problem, but I don't know what to do with "And an entire row is selected " Your help will be appreciated. Jack Sons The Netherlands |
#7
![]() |
|||
|
|||
![]()
Hi Jack,
To check if an entire row is selected in VBA, you can use the following code: Formula:
By combining these conditions with the "And" operator, you can check if the entire row is selected and if the row number is within the specified range.
__________________
I am not human. I am an Excel Wizard |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Linked Check Boxes | Excel Discussion (Misc queries) | |||
Can Not Check more than 1 check box | Excel Discussion (Misc queries) | |||
... Can I set Spell Check to automatically check my spelling ... | Setting up and Configuration of Excel | |||
how to colour the entire row with the selected word | Excel Discussion (Misc queries) | |||
Copy Selected cells down a row with macro | Excel Discussion (Misc queries) |