Consulting

Page 1 of 2 1 2 LastLast
Results 1 to 20 of 23

Thread: getting values dynamically from cells A1 t0 A100

  1. #1

    Question getting values dynamically from cells A1 t0 A100

    Guys help to get values dynamically from cells A1 to A100, i have implemented an algorithm in which i have fetched value from cell A1 processed displayed the result in B1. Now i need to do the same for all cells from A2 to A100 and need to display the result in B2 to B100

    Plz help me!! with codes

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Seems too obvious!

    [vba]

    Range("A2:A100").Copy Range("B2")
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    thanks for your reply.

    Actually i have read the value from cell A1 and assigned it to n. then processed the value
    "n = Worksheets("sheet1").Range("A1")"
    now i want to repeat the step with A2(fetch the value from A2 cell assign to n and then to process)

    This should be repeated till the loop reaches A100

    Plz help me!!!

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    For i = 1 To 100

    n = Worksheets("Sheet1").Cells(i, "A").Value
    Next i
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    Thanks a lot it worked for me!!!!

  6. #6
    One more doubt xld,

    if i am going to paste some 'X' values in from cell A1 to A'x', then i need to find the number 'x'. how do i get it???

    Plz guide me !!!

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I don't know. How is x determined?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  8. #8
    depends on the total number of values i am going to paste in a column. for example
    A1-A56 or A1-A367 like that

    awaiting for ur reply.

  9. #9
    VBAX Expert shrivallabha's Avatar
    Joined
    Jan 2010
    Location
    Mumbai
    Posts
    750
    Location
    If you are trying to figure out the last row in the column A then use:

    Using ActiveSheet
    [VBA]ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row[/VBA]

    Unnamed Sheet1
    [VBA]Sheet1.Range("A" & Rows.Count).End(xlUp).Row[/VBA]

    Named "MySheet"
    [VBA]Sheets("MySheet").Range("A" & Rows.Count).End(xlUp).Row[/VBA]
    Regards,
    --------------------------------------------------------------------------------------------------------
    Shrivallabha
    --------------------------------------------------------------------------------------------------------
    Using Excel 2016 in Home / 2010 in Office
    --------------------------------------------------------------------------------------------------------

  10. #10
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by sathishesb
    depends on the total number of values i am going to paste in a column. for example
    A1-A56 or A1-A367 like that

    awaiting for ur reply.
    Unless you tell how x is determined, there is no help we can offer.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  11. #11
    Thanks a lot shrivallabha.. it worked for me...

    Thanks for ur rely xld... i think from shrivallabha post you would have understand by question.

    Thanks a lot for both of you!!!!

  12. #12
    Another query, In a loop i am reading values from each cell of Column A. If the cell is blank then it seems it read it as 'NULL' .

    My query is: hw to check a variable is NULL..

    i tried "if N is NULL" but it throwed error.

    Please suggest me an answer....

  13. #13
    VBAX Expert shrivallabha's Avatar
    Joined
    Jan 2010
    Location
    Mumbai
    Posts
    750
    Location
    It is better to put a new query separately. And you will stand a better chance if you post a sample explaining your requirement completely.

    To handle blank case:
    [vba]
    With Sheet1
    For i = 2 To LastRow
    If .Range("A" & i).value = "" Then
    'Mycode for blank cell
    Else
    'Mycode for non-blank cell
    End If
    Next i
    End With[/vba]
    Regards,
    --------------------------------------------------------------------------------------------------------
    Shrivallabha
    --------------------------------------------------------------------------------------------------------
    Using Excel 2016 in Home / 2010 in Office
    --------------------------------------------------------------------------------------------------------

  14. #14
    it worked!!!
    Thanks a lot for your help guys!!!!!!!!!!!!!!!!!!!!!!

  15. #15
    another query,

    How to find the lenght of a particular text present in a cell??

    for example : 123456789 is there in A1, then i have to get the result as 9

    can anyone help this plzzzzzz...............

  16. #16
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Try

    =LEN(A1)
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  17. #17
    VBAX Expert Tinbendr's Avatar
    Joined
    Jun 2005
    Location
    North Central Mississippi (The Pines)
    Posts
    993
    Location
    For instance, [VBA]A = Len(A1)[/VBA]

  18. #18
    thanks a lot!!!!

  19. #19
    guys, Is there any way to convert the VBA codes into a protected mode. similar to JAR files in JAVA.

    Plzzzz help me guys!!!

  20. #20
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    VBA can be protected, but it is as secure as liquorice.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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