+ Reply to Thread
Results 1 to 9 of 9

Select paticular cells

  1. #1
    vijaya
    Guest

    Select paticular cells

    I want to select particular cells . Its like got to select every consecutive
    3rd cell of a particular column.

    Eg: Say column F, I have to select F3, F6, F9...and so on.

    I am not sure if we can use macros and range to program this or how to do,
    Is it possible to get this way.Pls let me know

    Thanks
    Vijaya

  2. #2
    sebastienm
    Guest

    RE: Select paticular cells

    Hi,

    you can try something like:
    '---------------------------------------------------
    Sub test()
    Dim strCol As String, rowStart As Long, rowOffset As Long
    Dim rg As Range
    Dim lastRow As Long, i As Long

    strCol = "F" 'COLUMN
    rowStart = 3 'START SELECTION IN tHIS ROW
    rowOffset = 3 'SELECT EVERY x ROW

    With ActiveSheet
    Set rg = .UsedRange.Columns(1) 'determine last row
    lastRow = rg.Cells(rg.Cells.Count).Row

    Set rg = .Range(strCol & rowStart) 'set initial range
    For i = rowStart + rowOffset To lastRow Step rowOffset 'loop
    Set rg = Application.Union(rg, .Range(strCol & i))
    Next
    End With

    If rg Is Nothing Then 'no cell
    MsgBox "No cell"
    Else
    rg.Select
    End If
    End Sub
    '-------------------------------------------------------------------

    --
    Regards,
    Sébastien
    <http://www.ondemandanalysis.com>


    "vijaya" wrote:

    > I want to select particular cells . Its like got to select every consecutive
    > 3rd cell of a particular column.
    >
    > Eg: Say column F, I have to select F3, F6, F9...and so on.
    >
    > I am not sure if we can use macros and range to program this or how to do,
    > Is it possible to get this way.Pls let me know
    >
    > Thanks
    > Vijaya


  3. #3
    vijaya
    Guest

    RE: Select paticular cells

    I thought I could copy and paste a formula on to the selected cells, but once
    i run the macro, the cells get selected but I could not copy paste it, ihow
    can i do this

    "vijaya" wrote:

    > I want to select particular cells . Its like got to select every consecutive
    > 3rd cell of a particular column.
    >
    > Eg: Say column F, I have to select F3, F6, F9...and so on.
    >
    > I am not sure if we can use macros and range to program this or how to do,
    > Is it possible to get this way.Pls let me know
    >
    > Thanks
    > Vijaya


  4. #4
    sebastienm
    Guest

    RE: Select paticular cells

    Not sure what you are trying to accomplish.

    If you want to Copy/Paste the cells, you can use the syntax:
    RangeOrigin.Copy RangeDestination
    eg: copy rg to cells starting in Z10
    Rg.Copy ActiveSheet.Range("$Z$10")
    --
    Regards,
    Sébastien
    <http://www.ondemandanalysis.com>


    "vijaya" wrote:

    > I thought I could copy and paste a formula on to the selected cells, but once
    > i run the macro, the cells get selected but I could not copy paste it, ihow
    > can i do this
    >
    > "vijaya" wrote:
    >
    > > I want to select particular cells . Its like got to select every consecutive
    > > 3rd cell of a particular column.
    > >
    > > Eg: Say column F, I have to select F3, F6, F9...and so on.
    > >
    > > I am not sure if we can use macros and range to program this or how to do,
    > > Is it possible to get this way.Pls let me know
    > >
    > > Thanks
    > > Vijaya


  5. #5
    vijaya
    Guest

    RE: Select paticular cells


    Ok, Actually I have a formula which i wanted to paste in every alternate
    cell like F3, F5, F7... uptil the data is filled in the rows.

    I am not sure how to do this at one step, as I dont want to select all these
    non-contiguous cells using ctrl key and then paste the formula. I thought
    selecting the cells at once by running a macro and then pasting it could be
    done, but it didnt.
    "sebastienm" wrote:

    > Not sure what you are trying to accomplish.
    >
    > If you want to Copy/Paste the cells, you can use the syntax:
    > RangeOrigin.Copy RangeDestination
    > eg: copy rg to cells starting in Z10
    > Rg.Copy ActiveSheet.Range("$Z$10")
    > --
    > Regards,
    > Sébastien
    > <http://www.ondemandanalysis.com>
    >
    >
    > "vijaya" wrote:
    >
    > > I thought I could copy and paste a formula on to the selected cells, but once
    > > i run the macro, the cells get selected but I could not copy paste it, ihow
    > > can i do this
    > >
    > > "vijaya" wrote:
    > >
    > > > I want to select particular cells . Its like got to select every consecutive
    > > > 3rd cell of a particular column.
    > > >
    > > > Eg: Say column F, I have to select F3, F6, F9...and so on.
    > > >
    > > > I am not sure if we can use macros and range to program this or how to do,
    > > > Is it possible to get this way.Pls let me know
    > > >
    > > > Thanks
    > > > Vijaya


  6. #6
    vijaya
    Guest

    RE: Select paticular cells

    Hi
    I got it I could copy it to multiple selected non contiguous cells

    Thanks a lot!!

    I appreciate your time and help

    "sebastienm" wrote:

    > Not sure what you are trying to accomplish.
    >
    > If you want to Copy/Paste the cells, you can use the syntax:
    > RangeOrigin.Copy RangeDestination
    > eg: copy rg to cells starting in Z10
    > Rg.Copy ActiveSheet.Range("$Z$10")
    > --
    > Regards,
    > Sébastien
    > <http://www.ondemandanalysis.com>
    >
    >
    > "vijaya" wrote:
    >
    > > I thought I could copy and paste a formula on to the selected cells, but once
    > > i run the macro, the cells get selected but I could not copy paste it, ihow
    > > can i do this
    > >
    > > "vijaya" wrote:
    > >
    > > > I want to select particular cells . Its like got to select every consecutive
    > > > 3rd cell of a particular column.
    > > >
    > > > Eg: Say column F, I have to select F3, F6, F9...and so on.
    > > >
    > > > I am not sure if we can use macros and range to program this or how to do,
    > > > Is it possible to get this way.Pls let me know
    > > >
    > > > Thanks
    > > > Vijaya


  7. #7
    vijaya
    Guest

    RE: Select paticular cells

    Just a small Information.

    I am a beginner in Excel VBA programming.I want to learn Excel VBA, and
    write programs efficiently by myself, Cud u please let me know which book I
    can follow .

    Thanks

    "sebastienm" wrote:

    > Not sure what you are trying to accomplish.
    >
    > If you want to Copy/Paste the cells, you can use the syntax:
    > RangeOrigin.Copy RangeDestination
    > eg: copy rg to cells starting in Z10
    > Rg.Copy ActiveSheet.Range("$Z$10")
    > --
    > Regards,
    > Sébastien
    > <http://www.ondemandanalysis.com>
    >
    >
    > "vijaya" wrote:
    >
    > > I thought I could copy and paste a formula on to the selected cells, but once
    > > i run the macro, the cells get selected but I could not copy paste it, ihow
    > > can i do this
    > >
    > > "vijaya" wrote:
    > >
    > > > I want to select particular cells . Its like got to select every consecutive
    > > > 3rd cell of a particular column.
    > > >
    > > > Eg: Say column F, I have to select F3, F6, F9...and so on.
    > > >
    > > > I am not sure if we can use macros and range to program this or how to do,
    > > > Is it possible to get this way.Pls let me know
    > > >
    > > > Thanks
    > > > Vijaya


  8. #8
    sebastienm
    Guest

    RE: Select paticular cells

    There's a book that is very easy to read: John Walkenbach "Excel 2003 Power
    Programming With VBA" (http://j-walk.com/ss/books/index.htm). I started with
    the xl97 version of this book, then bought the 2k version. I think it's a
    good book for both beginers and intermediates, and focused on Excel.
    I mostly learn by trying solving people's probelems in newsgroups.
    There are also some good advanced book, but i wouldn't start with these ones
    (Stephen Bullen "Professional Excel Development.", ...)

    I hope this helps
    --
    Regards,
    Sébastien
    <http://www.ondemandanalysis.com>


    "vijaya" wrote:

    > Just a small Information.
    >
    > I am a beginner in Excel VBA programming.I want to learn Excel VBA, and
    > write programs efficiently by myself, Cud u please let me know which book I
    > can follow .
    >
    > Thanks
    >
    > "sebastienm" wrote:
    >
    > > Not sure what you are trying to accomplish.
    > >
    > > If you want to Copy/Paste the cells, you can use the syntax:
    > > RangeOrigin.Copy RangeDestination
    > > eg: copy rg to cells starting in Z10
    > > Rg.Copy ActiveSheet.Range("$Z$10")
    > > --
    > > Regards,
    > > Sébastien
    > > <http://www.ondemandanalysis.com>
    > >
    > >
    > > "vijaya" wrote:
    > >
    > > > I thought I could copy and paste a formula on to the selected cells, but once
    > > > i run the macro, the cells get selected but I could not copy paste it, ihow
    > > > can i do this
    > > >
    > > > "vijaya" wrote:
    > > >
    > > > > I want to select particular cells . Its like got to select every consecutive
    > > > > 3rd cell of a particular column.
    > > > >
    > > > > Eg: Say column F, I have to select F3, F6, F9...and so on.
    > > > >
    > > > > I am not sure if we can use macros and range to program this or how to do,
    > > > > Is it possible to get this way.Pls let me know
    > > > >
    > > > > Thanks
    > > > > Vijaya


  9. #9
    vijaya
    Guest

    RE: Select paticular cells


    Hi,
    Iam just wondering if data arranged as in the original list can be shown as
    in the result list:

    Original List:
    A B
    In the diamond In the diamond
    In the diamond The City
    In the diamond Trench
    The City
    The City
    Trench


    Result :

    A B
    In the diamond In the diamond
    In the diamond
    In the diamond
    The City The City
    The City
    Trench Trench

    Is it possible to get like this:

    I am just wondering if a logic like this works out, and how can a code be
    written, is there any other way to do if not like this
    If B=A
    B=B (remain the data in B)
    Else
    Lookup (lookup for that item)
    Match (I think only match is fine; it looks for the item returns the
    row number)
    Next place it in that row, same column B
    If no match found: Place it in column B, but last row of A where the item
    list is over

    Thankyou
    "sebastienm" wrote:

    > There's a book that is very easy to read: John Walkenbach "Excel 2003 Power
    > Programming With VBA" (http://j-walk.com/ss/books/index.htm). I started with
    > the xl97 version of this book, then bought the 2k version. I think it's a
    > good book for both beginers and intermediates, and focused on Excel.
    > I mostly learn by trying solving people's probelems in newsgroups.
    > There are also some good advanced book, but i wouldn't start with these ones
    > (Stephen Bullen "Professional Excel Development.", ...)
    >
    > I hope this helps
    > --
    > Regards,
    > Sébastien
    > <http://www.ondemandanalysis.com>
    >
    >
    > "vijaya" wrote:
    >
    > > Just a small Information.
    > >
    > > I am a beginner in Excel VBA programming.I want to learn Excel VBA, and
    > > write programs efficiently by myself, Cud u please let me know which book I
    > > can follow .
    > >
    > > Thanks
    > >
    > > "sebastienm" wrote:
    > >
    > > > Not sure what you are trying to accomplish.
    > > >
    > > > If you want to Copy/Paste the cells, you can use the syntax:
    > > > RangeOrigin.Copy RangeDestination
    > > > eg: copy rg to cells starting in Z10
    > > > Rg.Copy ActiveSheet.Range("$Z$10")
    > > > --
    > > > Regards,
    > > > Sébastien
    > > > <http://www.ondemandanalysis.com>
    > > >
    > > >
    > > > "vijaya" wrote:
    > > >
    > > > > I thought I could copy and paste a formula on to the selected cells, but once
    > > > > i run the macro, the cells get selected but I could not copy paste it, ihow
    > > > > can i do this
    > > > >
    > > > > "vijaya" wrote:
    > > > >
    > > > > > I want to select particular cells . Its like got to select every consecutive
    > > > > > 3rd cell of a particular column.
    > > > > >
    > > > > > Eg: Say column F, I have to select F3, F6, F9...and so on.
    > > > > >
    > > > > > I am not sure if we can use macros and range to program this or how to do,
    > > > > > Is it possible to get this way.Pls let me know
    > > > > >
    > > > > > Thanks
    > > > > > Vijaya


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1