PC Review


Reply
Thread Tools Rate Thread

Active range/selection?

 
 
anita
Guest
Posts: n/a
 
      15th Sep 2006
Hi,

I would like to have a macro which picks up my selected range in a
workbook, similair to the activecell. So when I select a range in my
workbook, it will be set as range in my macro.


I've tried active.range but this doens't work (something like this: Set
dd = Active.Range). I can't find it in the list properties/methods in
vba.
Could somebody help me?
Thanks in advance.

 
Reply With Quote
 
 
 
 
Richard Buttrey
Guest
Posts: n/a
 
      15th Sep 2006
On 15 Sep 2006 04:46:27 -0700, "anita" <(E-Mail Removed)> wrote:

>Hi,
>
>I would like to have a macro which picks up my selected range in a
>workbook, similair to the activecell. So when I select a range in my
>workbook, it will be set as range in my macro.
>
>
>I've tried active.range but this doens't work (something like this: Set
>dd = Active.Range). I can't find it in the list properties/methods in
>vba.
>Could somebody help me?
>Thanks in advance.


If your range is a contiguous range with no columns or rows with null
values, then with the active cell somewhere in the range you could use

Set dd = ActiveCell.CurrentRegion


HTH

__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________
 
Reply With Quote
 
Roger Govier
Guest
Posts: n/a
 
      15th Sep 2006
Hi Anita

I think you need something like
set dd - activecell.currentregion

--
Regards

Roger Govier


"anita" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I would like to have a macro which picks up my selected range in a
> workbook, similair to the activecell. So when I select a range in my
> workbook, it will be set as range in my macro.
>
>
> I've tried active.range but this doens't work (something like this:
> Set
> dd = Active.Range). I can't find it in the list properties/methods in
> vba.
> Could somebody help me?
> Thanks in advance.
>



 
Reply With Quote
 
Roger Govier
Guest
Posts: n/a
 
      15th Sep 2006
Sorry

That "-" was meant to be an "="

set dd = activecell.currentregion

--
Regards

Roger Govier


"Roger Govier" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Anita
>
> I think you need something like
> set dd - activecell.currentregion
>
> --
> Regards
>
> Roger Govier
>
>
> "anita" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi,
>>
>> I would like to have a macro which picks up my selected range in a
>> workbook, similair to the activecell. So when I select a range in my
>> workbook, it will be set as range in my macro.
>>
>>
>> I've tried active.range but this doens't work (something like this:
>> Set
>> dd = Active.Range). I can't find it in the list properties/methods in
>> vba.
>> Could somebody help me?
>> Thanks in advance.
>>

>
>



 
Reply With Quote
 
anita
Guest
Posts: n/a
 
      15th Sep 2006
Hi Roger and Richard,

Thank you both for the quick respons. In my macro it doens't really
work as I hoped it to be. When I run this macro he only activates the
first cell and fills in a 1 if it has the beneath conditions. Maybe I'm
doing something wrong. Below is my macro:

Sub oke()
Application.ScreenUpdating = False
ActiveSheet.Unprotect ("arnhem12")

Set d = ActiveCell.CurrentRegion

For Each c In d
If c.Interior.ColorIndex = xlNone And _
c.Borders(xlEdgeLeft).Weight = xlThin And _
c.Borders(xlEdgeLeft).ColorIndex = xlAutomatic And _
c.Borders(xlEdgeTop).LineStyle = xlContinuous And _
c.Borders(xlEdgeTop).Weight = xlThin And _
c.Borders(xlEdgeTop).ColorIndex = xlAutomatic And _
c.Borders(xlEdgeBottom).LineStyle = xlContinuous And _
c.Borders(xlEdgeBottom).Weight = xlThin And _
c.Borders(xlEdgeBottom).ColorIndex = xlAutomatic And _
c.Borders(xlEdgeRight).LineStyle = xlContinuous And _
c.Borders(xlEdgeRight).Weight = xlThin And _
c.Locked = False And _
c.Borders(xlEdgeRight).ColorIndex = xlAutomatic Then
c.Value = 1
End If
Next c
ActiveSheet.Protect ("arnhem12")
MsgBox ("Finished")
Application.ScreenUpdating = True

End Sub

Greetings anita

Roger Govier schreef:

> Sorry
>
> That "-" was meant to be an "="
>
> set dd = activecell.currentregion
>
> --
> Regards
>
> Roger Govier
>
>
> "Roger Govier" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi Anita
> >
> > I think you need something like
> > set dd - activecell.currentregion
> >
> > --
> > Regards
> >
> > Roger Govier
> >
> >
> > "anita" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> Hi,
> >>
> >> I would like to have a macro which picks up my selected range in a
> >> workbook, similair to the activecell. So when I select a range in my
> >> workbook, it will be set as range in my macro.
> >>
> >>
> >> I've tried active.range but this doens't work (something like this:
> >> Set
> >> dd = Active.Range). I can't find it in the list properties/methods in
> >> vba.
> >> Could somebody help me?
> >> Thanks in advance.
> >>

> >
> >


 
Reply With Quote
 
anita
Guest
Posts: n/a
 
      15th Sep 2006
Hi Roger and Richard,

Thank you both for the quick respons. In my macro it doens't really
work as I hoped it to be. When I run this macro he only activates the
first cell and fills in a 1 if it has the beneath conditions. Maybe I'm
doing something wrong. Below is my macro:

Sub oke()
Application.ScreenUpdating = False
ActiveSheet.Unprotect ("arnhem12")

Set d = ActiveCell.CurrentRegion

For Each c In d
If c.Interior.ColorIndex = xlNone And _
c.Borders(xlEdgeLeft).Weight = xlThin And _
c.Borders(xlEdgeLeft).ColorIndex = xlAutomatic And _
c.Borders(xlEdgeTop).LineStyle = xlContinuous And _
c.Borders(xlEdgeTop).Weight = xlThin And _
c.Borders(xlEdgeTop).ColorIndex = xlAutomatic And _
c.Borders(xlEdgeBottom).LineStyle = xlContinuous And _
c.Borders(xlEdgeBottom).Weight = xlThin And _
c.Borders(xlEdgeBottom).ColorIndex = xlAutomatic And _
c.Borders(xlEdgeRight).LineStyle = xlContinuous And _
c.Borders(xlEdgeRight).Weight = xlThin And _
c.Locked = False And _
c.Borders(xlEdgeRight).ColorIndex = xlAutomatic Then
c.Value = 1
End If
Next c
ActiveSheet.Protect ("arnhem12")
MsgBox ("Finished")
Application.ScreenUpdating = True

End Sub

Greetings anita

Roger Govier schreef:

> Sorry
>
> That "-" was meant to be an "="
>
> set dd = activecell.currentregion
>
> --
> Regards
>
> Roger Govier
>
>
> "Roger Govier" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi Anita
> >
> > I think you need something like
> > set dd - activecell.currentregion
> >
> > --
> > Regards
> >
> > Roger Govier
> >
> >
> > "anita" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> Hi,
> >>
> >> I would like to have a macro which picks up my selected range in a
> >> workbook, similair to the activecell. So when I select a range in my
> >> workbook, it will be set as range in my macro.
> >>
> >>
> >> I've tried active.range but this doens't work (something like this:
> >> Set
> >> dd = Active.Range). I can't find it in the list properties/methods in
> >> vba.
> >> Could somebody help me?
> >> Thanks in advance.
> >>

> >
> >


 
Reply With Quote
 
Richard Buttrey
Guest
Posts: n/a
 
      15th Sep 2006
Assuming all the line formatting is set as per the macro parameters,
then that suggests that the first cell is the only one which is
unlocked.

Check the others, (Format-->Cells Protection Tab) and confirm that
they are all unlocked and if so post back. Otherwise the macro would
appear to be working correctly, i.e only setting a '1' for the only
cell which is unlocked.

HTH

On 15 Sep 2006 05:37:46 -0700, "anita" <(E-Mail Removed)> wrote:

>Hi Roger and Richard,
>
>Thank you both for the quick respons. In my macro it doens't really
>work as I hoped it to be. When I run this macro he only activates the
>first cell and fills in a 1 if it has the beneath conditions. Maybe I'm
>doing something wrong. Below is my macro:
>
>Sub oke()
> Application.ScreenUpdating = False
> ActiveSheet.Unprotect ("arnhem12")
>
> Set d = ActiveCell.CurrentRegion
>
> For Each c In d
> If c.Interior.ColorIndex = xlNone And _
> c.Borders(xlEdgeLeft).Weight = xlThin And _
> c.Borders(xlEdgeLeft).ColorIndex = xlAutomatic And _
> c.Borders(xlEdgeTop).LineStyle = xlContinuous And _
> c.Borders(xlEdgeTop).Weight = xlThin And _
> c.Borders(xlEdgeTop).ColorIndex = xlAutomatic And _
> c.Borders(xlEdgeBottom).LineStyle = xlContinuous And _
> c.Borders(xlEdgeBottom).Weight = xlThin And _
> c.Borders(xlEdgeBottom).ColorIndex = xlAutomatic And _
> c.Borders(xlEdgeRight).LineStyle = xlContinuous And _
> c.Borders(xlEdgeRight).Weight = xlThin And _
> c.Locked = False And _
> c.Borders(xlEdgeRight).ColorIndex = xlAutomatic Then
> c.Value = 1
> End If
> Next c
> ActiveSheet.Protect ("arnhem12")
> MsgBox ("Finished")
> Application.ScreenUpdating = True
>
>End Sub
>
>Greetings anita
>
>Roger Govier schreef:
>
>> Sorry
>>
>> That "-" was meant to be an "="
>>
>> set dd = activecell.currentregion
>>
>> --
>> Regards
>>
>> Roger Govier
>>
>>
>> "Roger Govier" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Hi Anita
>> >
>> > I think you need something like
>> > set dd - activecell.currentregion
>> >
>> > --
>> > Regards
>> >
>> > Roger Govier
>> >
>> >
>> > "anita" <(E-Mail Removed)> wrote in message
>> > news:(E-Mail Removed)...
>> >> Hi,
>> >>
>> >> I would like to have a macro which picks up my selected range in a
>> >> workbook, similair to the activecell. So when I select a range in my
>> >> workbook, it will be set as range in my macro.
>> >>
>> >>
>> >> I've tried active.range but this doens't work (something like this:
>> >> Set
>> >> dd = Active.Range). I can't find it in the list properties/methods in
>> >> vba.
>> >> Could somebody help me?
>> >> Thanks in advance.
>> >>
>> >
>> >


__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________
 
Reply With Quote
 
anita
Guest
Posts: n/a
 
      15th Sep 2006
Hi Richard,

Yes, that could be it. I the meanwhile I have found another solution,
see below. I have use activewindow.rangeselection.address and it works.
Thanks for your support and the time you've been putting in it.

Sub oke()
' Keyboard Shortcut: Ctrl+e

Application.ScreenUpdating = False
ActiveSheet.Unprotect ("x")
a = ActiveWindow.RangeSelection.Address
Range("C13").Select
Set d = Range(a)

For Each c In d
If c.Interior.ColorIndex = xlNone And _
c.Borders(xlEdgeLeft).Weight = xlThin And _
c.Borders(xlEdgeLeft).ColorIndex = xlAutomatic And _
c.Borders(xlEdgeTop).LineStyle = xlContinuous And _
c.Borders(xlEdgeTop).Weight = xlThin And _
c.Borders(xlEdgeTop).ColorIndex = xlAutomatic And _
c.Borders(xlEdgeBottom).LineStyle = xlContinuous And _
c.Borders(xlEdgeBottom).Weight = xlThin And _
c.Borders(xlEdgeBottom).ColorIndex = xlAutomatic And _
c.Borders(xlEdgeRight).LineStyle = xlContinuous And _
c.Borders(xlEdgeRight).Weight = xlThin And _
c.Locked = False And _
c.Borders(xlEdgeRight).ColorIndex = xlAutomatic Then
c.Value = 1
End If
Next c
ActiveSheet.Protect ("x")
MsgBox ("Finished")
Application.ScreenUpdating = True

End Sub

Greetings anita

Richard Buttrey schreef:

> Assuming all the line formatting is set as per the macro parameters,
> then that suggests that the first cell is the only one which is
> unlocked.
>
> Check the others, (Format-->Cells Protection Tab) and confirm that
> they are all unlocked and if so post back. Otherwise the macro would
> appear to be working correctly, i.e only setting a '1' for the only
> cell which is unlocked.
>
> HTH
>
> On 15 Sep 2006 05:37:46 -0700, "anita" <(E-Mail Removed)> wrote:
>
> >Hi Roger and Richard,
> >
> >Thank you both for the quick respons. In my macro it doens't really
> >work as I hoped it to be. When I run this macro he only activates the
> >first cell and fills in a 1 if it has the beneath conditions. Maybe I'm
> >doing something wrong. Below is my macro:
> >
> >Sub oke()
> > Application.ScreenUpdating = False
> > ActiveSheet.Unprotect ("arnhem12")
> >
> > Set d = ActiveCell.CurrentRegion
> >
> > For Each c In d
> > If c.Interior.ColorIndex = xlNone And _
> > c.Borders(xlEdgeLeft).Weight = xlThin And _
> > c.Borders(xlEdgeLeft).ColorIndex = xlAutomatic And _
> > c.Borders(xlEdgeTop).LineStyle = xlContinuous And _
> > c.Borders(xlEdgeTop).Weight = xlThin And _
> > c.Borders(xlEdgeTop).ColorIndex = xlAutomatic And _
> > c.Borders(xlEdgeBottom).LineStyle = xlContinuous And _
> > c.Borders(xlEdgeBottom).Weight = xlThin And _
> > c.Borders(xlEdgeBottom).ColorIndex = xlAutomatic And _
> > c.Borders(xlEdgeRight).LineStyle = xlContinuous And _
> > c.Borders(xlEdgeRight).Weight = xlThin And _
> > c.Locked = False And _
> > c.Borders(xlEdgeRight).ColorIndex = xlAutomatic Then
> > c.Value = 1
> > End If
> > Next c
> > ActiveSheet.Protect ("arnhem12")
> > MsgBox ("Finished")
> > Application.ScreenUpdating = True
> >
> >End Sub
> >
> >Greetings anita
> >
> >Roger Govier schreef:
> >
> >> Sorry
> >>
> >> That "-" was meant to be an "="
> >>
> >> set dd = activecell.currentregion
> >>
> >> --
> >> Regards
> >>
> >> Roger Govier
> >>
> >>
> >> "Roger Govier" <(E-Mail Removed)> wrote in message
> >> news:(E-Mail Removed)...
> >> > Hi Anita
> >> >
> >> > I think you need something like
> >> > set dd - activecell.currentregion
> >> >
> >> > --
> >> > Regards
> >> >
> >> > Roger Govier
> >> >
> >> >
> >> > "anita" <(E-Mail Removed)> wrote in message
> >> > news:(E-Mail Removed)...
> >> >> Hi,
> >> >>
> >> >> I would like to have a macro which picks up my selected range in a
> >> >> workbook, similair to the activecell. So when I select a range in my
> >> >> workbook, it will be set as range in my macro.
> >> >>
> >> >>
> >> >> I've tried active.range but this doens't work (something like this:
> >> >> Set
> >> >> dd = Active.Range). I can't find it in the list properties/methods in
> >> >> vba.
> >> >> Could somebody help me?
> >> >> Thanks in advance.
> >> >>
> >> >
> >> >

>
> __
> Richard Buttrey
> Grappenhall, Cheshire, UK
> __________________________


 
Reply With Quote
 
Richard Buttrey
Guest
Posts: n/a
 
      15th Sep 2006
Hi,

It looks like you could also simplify and replace all that borders
stuff with

If c.Borders.LineStyle = xlContinuous And c.Locked = False Then
c.Value = 1

all on one code line

Rgds


On 15 Sep 2006 06:59:28 -0700, "anita" <(E-Mail Removed)> wrote:

>Hi Richard,
>
>Yes, that could be it. I the meanwhile I have found another solution,
>see below. I have use activewindow.rangeselection.address and it works.
>Thanks for your support and the time you've been putting in it.
>
>Sub oke()
>' Keyboard Shortcut: Ctrl+e
>
> Application.ScreenUpdating = False
> ActiveSheet.Unprotect ("x")
> a = ActiveWindow.RangeSelection.Address
> Range("C13").Select
> Set d = Range(a)
>
> For Each c In d
> If c.Interior.ColorIndex = xlNone And _
> c.Borders(xlEdgeLeft).Weight = xlThin And _
> c.Borders(xlEdgeLeft).ColorIndex = xlAutomatic And _
> c.Borders(xlEdgeTop).LineStyle = xlContinuous And _
> c.Borders(xlEdgeTop).Weight = xlThin And _
> c.Borders(xlEdgeTop).ColorIndex = xlAutomatic And _
> c.Borders(xlEdgeBottom).LineStyle = xlContinuous And _
> c.Borders(xlEdgeBottom).Weight = xlThin And _
> c.Borders(xlEdgeBottom).ColorIndex = xlAutomatic And _
> c.Borders(xlEdgeRight).LineStyle = xlContinuous And _
> c.Borders(xlEdgeRight).Weight = xlThin And _
> c.Locked = False And _
> c.Borders(xlEdgeRight).ColorIndex = xlAutomatic Then
> c.Value = 1
> End If
> Next c
> ActiveSheet.Protect ("x")
> MsgBox ("Finished")
> Application.ScreenUpdating = True
>
>End Sub
>
>Greetings anita
>
>Richard Buttrey schreef:
>
>> Assuming all the line formatting is set as per the macro parameters,
>> then that suggests that the first cell is the only one which is
>> unlocked.
>>
>> Check the others, (Format-->Cells Protection Tab) and confirm that
>> they are all unlocked and if so post back. Otherwise the macro would
>> appear to be working correctly, i.e only setting a '1' for the only
>> cell which is unlocked.
>>
>> HTH
>>
>> On 15 Sep 2006 05:37:46 -0700, "anita" <(E-Mail Removed)> wrote:
>>
>> >Hi Roger and Richard,
>> >
>> >Thank you both for the quick respons. In my macro it doens't really
>> >work as I hoped it to be. When I run this macro he only activates the
>> >first cell and fills in a 1 if it has the beneath conditions. Maybe I'm
>> >doing something wrong. Below is my macro:
>> >
>> >Sub oke()
>> > Application.ScreenUpdating = False
>> > ActiveSheet.Unprotect ("arnhem12")
>> >
>> > Set d = ActiveCell.CurrentRegion
>> >
>> > For Each c In d
>> > If c.Interior.ColorIndex = xlNone And _
>> > c.Borders(xlEdgeLeft).Weight = xlThin And _
>> > c.Borders(xlEdgeLeft).ColorIndex = xlAutomatic And _
>> > c.Borders(xlEdgeTop).LineStyle = xlContinuous And _
>> > c.Borders(xlEdgeTop).Weight = xlThin And _
>> > c.Borders(xlEdgeTop).ColorIndex = xlAutomatic And _
>> > c.Borders(xlEdgeBottom).LineStyle = xlContinuous And _
>> > c.Borders(xlEdgeBottom).Weight = xlThin And _
>> > c.Borders(xlEdgeBottom).ColorIndex = xlAutomatic And _
>> > c.Borders(xlEdgeRight).LineStyle = xlContinuous And _
>> > c.Borders(xlEdgeRight).Weight = xlThin And _
>> > c.Locked = False And _
>> > c.Borders(xlEdgeRight).ColorIndex = xlAutomatic Then
>> > c.Value = 1
>> > End If
>> > Next c
>> > ActiveSheet.Protect ("arnhem12")
>> > MsgBox ("Finished")
>> > Application.ScreenUpdating = True
>> >
>> >End Sub
>> >
>> >Greetings anita
>> >
>> >Roger Govier schreef:
>> >
>> >> Sorry
>> >>
>> >> That "-" was meant to be an "="
>> >>
>> >> set dd = activecell.currentregion
>> >>
>> >> --
>> >> Regards
>> >>
>> >> Roger Govier
>> >>
>> >>
>> >> "Roger Govier" <(E-Mail Removed)> wrote in message
>> >> news:(E-Mail Removed)...
>> >> > Hi Anita
>> >> >
>> >> > I think you need something like
>> >> > set dd - activecell.currentregion
>> >> >
>> >> > --
>> >> > Regards
>> >> >
>> >> > Roger Govier
>> >> >
>> >> >
>> >> > "anita" <(E-Mail Removed)> wrote in message
>> >> > news:(E-Mail Removed)...
>> >> >> Hi,
>> >> >>
>> >> >> I would like to have a macro which picks up my selected range in a
>> >> >> workbook, similair to the activecell. So when I select a range in my
>> >> >> workbook, it will be set as range in my macro.
>> >> >>
>> >> >>
>> >> >> I've tried active.range but this doens't work (something like this:
>> >> >> Set
>> >> >> dd = Active.Range). I can't find it in the list properties/methods in
>> >> >> vba.
>> >> >> Could somebody help me?
>> >> >> Thanks in advance.
>> >> >>
>> >> >
>> >> >

>>
>> __
>> Richard Buttrey
>> Grappenhall, Cheshire, UK
>> __________________________


__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________
 
Reply With Quote
 
anita
Guest
Posts: n/a
 
      20th Sep 2006
Hi richard,

Yes, that's better and much shorter. Thanks again.

Greetings anita

Richard Buttrey schreef:

> Hi,
>
> It looks like you could also simplify and replace all that borders
> stuff with
>
> If c.Borders.LineStyle = xlContinuous And c.Locked = False Then
> c.Value = 1
>
> all on one code line
>
> Rgds
>
>
> On 15 Sep 2006 06:59:28 -0700, "anita" <(E-Mail Removed)> wrote:
>
> >Hi Richard,
> >
> >Yes, that could be it. I the meanwhile I have found another solution,
> >see below. I have use activewindow.rangeselection.address and it works.
> >Thanks for your support and the time you've been putting in it.
> >
> >Sub oke()
> >' Keyboard Shortcut: Ctrl+e
> >
> > Application.ScreenUpdating = False
> > ActiveSheet.Unprotect ("x")
> > a = ActiveWindow.RangeSelection.Address
> > Range("C13").Select
> > Set d = Range(a)
> >
> > For Each c In d
> > If c.Interior.ColorIndex = xlNone And _
> > c.Borders(xlEdgeLeft).Weight = xlThin And _
> > c.Borders(xlEdgeLeft).ColorIndex = xlAutomatic And _
> > c.Borders(xlEdgeTop).LineStyle = xlContinuous And _
> > c.Borders(xlEdgeTop).Weight = xlThin And _
> > c.Borders(xlEdgeTop).ColorIndex = xlAutomatic And _
> > c.Borders(xlEdgeBottom).LineStyle = xlContinuous And _
> > c.Borders(xlEdgeBottom).Weight = xlThin And _
> > c.Borders(xlEdgeBottom).ColorIndex = xlAutomatic And _
> > c.Borders(xlEdgeRight).LineStyle = xlContinuous And _
> > c.Borders(xlEdgeRight).Weight = xlThin And _
> > c.Locked = False And _
> > c.Borders(xlEdgeRight).ColorIndex = xlAutomatic Then
> > c.Value = 1
> > End If
> > Next c
> > ActiveSheet.Protect ("x")
> > MsgBox ("Finished")
> > Application.ScreenUpdating = True
> >
> >End Sub
> >
> >Greetings anita
> >
> >Richard Buttrey schreef:
> >
> >> Assuming all the line formatting is set as per the macro parameters,
> >> then that suggests that the first cell is the only one which is
> >> unlocked.
> >>
> >> Check the others, (Format-->Cells Protection Tab) and confirm that
> >> they are all unlocked and if so post back. Otherwise the macro would
> >> appear to be working correctly, i.e only setting a '1' for the only
> >> cell which is unlocked.
> >>
> >> HTH
> >>
> >> On 15 Sep 2006 05:37:46 -0700, "anita" <(E-Mail Removed)> wrote:
> >>
> >> >Hi Roger and Richard,
> >> >
> >> >Thank you both for the quick respons. In my macro it doens't really
> >> >work as I hoped it to be. When I run this macro he only activates the
> >> >first cell and fills in a 1 if it has the beneath conditions. Maybe I'm
> >> >doing something wrong. Below is my macro:
> >> >
> >> >Sub oke()
> >> > Application.ScreenUpdating = False
> >> > ActiveSheet.Unprotect ("arnhem12")
> >> >
> >> > Set d = ActiveCell.CurrentRegion
> >> >
> >> > For Each c In d
> >> > If c.Interior.ColorIndex = xlNone And _
> >> > c.Borders(xlEdgeLeft).Weight = xlThin And _
> >> > c.Borders(xlEdgeLeft).ColorIndex = xlAutomatic And _
> >> > c.Borders(xlEdgeTop).LineStyle = xlContinuous And _
> >> > c.Borders(xlEdgeTop).Weight = xlThin And _
> >> > c.Borders(xlEdgeTop).ColorIndex = xlAutomatic And _
> >> > c.Borders(xlEdgeBottom).LineStyle = xlContinuous And _
> >> > c.Borders(xlEdgeBottom).Weight = xlThin And _
> >> > c.Borders(xlEdgeBottom).ColorIndex = xlAutomatic And _
> >> > c.Borders(xlEdgeRight).LineStyle = xlContinuous And _
> >> > c.Borders(xlEdgeRight).Weight = xlThin And _
> >> > c.Locked = False And _
> >> > c.Borders(xlEdgeRight).ColorIndex = xlAutomatic Then
> >> > c.Value = 1
> >> > End If
> >> > Next c
> >> > ActiveSheet.Protect ("arnhem12")
> >> > MsgBox ("Finished")
> >> > Application.ScreenUpdating = True
> >> >
> >> >End Sub
> >> >
> >> >Greetings anita
> >> >
> >> >Roger Govier schreef:
> >> >
> >> >> Sorry
> >> >>
> >> >> That "-" was meant to be an "="
> >> >>
> >> >> set dd = activecell.currentregion
> >> >>
> >> >> --
> >> >> Regards
> >> >>
> >> >> Roger Govier
> >> >>
> >> >>
> >> >> "Roger Govier" <(E-Mail Removed)> wrote in message
> >> >> news:(E-Mail Removed)...
> >> >> > Hi Anita
> >> >> >
> >> >> > I think you need something like
> >> >> > set dd - activecell.currentregion
> >> >> >
> >> >> > --
> >> >> > Regards
> >> >> >
> >> >> > Roger Govier
> >> >> >
> >> >> >
> >> >> > "anita" <(E-Mail Removed)> wrote in message
> >> >> > news:(E-Mail Removed)...
> >> >> >> Hi,
> >> >> >>
> >> >> >> I would like to have a macro which picks up my selected range in a
> >> >> >> workbook, similair to the activecell. So when I select a range in my
> >> >> >> workbook, it will be set as range in my macro.
> >> >> >>
> >> >> >>
> >> >> >> I've tried active.range but this doens't work (something like this:
> >> >> >> Set
> >> >> >> dd = Active.Range). I can't find it in the list properties/methods in
> >> >> >> vba.
> >> >> >> Could somebody help me?
> >> >> >> Thanks in advance.
> >> >> >>
> >> >> >
> >> >> >
> >>
> >> __
> >> Richard Buttrey
> >> Grappenhall, Cheshire, UK
> >> __________________________

>
> __
> Richard Buttrey
> Grappenhall, Cheshire, UK
> __________________________


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change the active cell in a non contiguous range or selection? ptroiano Microsoft Excel Programming 0 8th Nov 2009 09:55 PM
getting the selected range and active cell of a non active worksheetsheet GerryGerry Microsoft Excel Programming 7 23rd Sep 2009 05:22 PM
Change InputBox Range Selection to Column Letter Selection intoit Microsoft Excel Programming 2 21st Jul 2009 07:58 AM
Range(Selection, Selection.End(xlToRight)).Select =?Utf-8?B?RGF2ZSBCaXJsZXk=?= Microsoft Excel Programming 2 6th Jun 2007 04:53 PM
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. jonH Microsoft Excel Programming 3 7th Jun 2004 09:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:48 PM.