+ Reply to Thread
Results 1 to 22 of 22

rows.count vs column.count

Hybrid View

rcprito rows.count vs column.count 03-08-2013, 10:32 AM
Norie Re: rows.count vs column.count 03-08-2013, 10:37 AM
arlu1201 Re: rows.count vs column.count 03-08-2013, 10:37 AM
rcprito Re: rows.count vs column.count 03-08-2013, 10:56 AM
patel45 Re: rows.count vs column.count 03-08-2013, 11:00 AM
Norie Re: rows.count vs column.count 03-08-2013, 11:03 AM
rcprito Re: rows.count vs column.count 03-08-2013, 11:17 AM
Norie Re: rows.count vs column.count 03-08-2013, 11:21 AM
rcprito Re: rows.count vs column.count 03-08-2013, 11:33 AM
Norie Re: rows.count vs column.count 03-08-2013, 11:48 AM
rcprito Re: rows.count vs column.count 03-08-2013, 12:06 PM
Norie Re: rows.count vs column.count 03-08-2013, 12:13 PM
rcprito Re: rows.count vs column.count 03-08-2013, 12:21 PM
Norie Re: rows.count vs column.count 03-08-2013, 12:37 PM
rcprito Re: rows.count vs column.count 03-08-2013, 12:38 PM
Norie Re: rows.count vs column.count 03-08-2013, 01:43 PM
rcprito Re: rows.count vs column.count 03-08-2013, 01:49 PM
Norie Re: rows.count vs column.count 03-08-2013, 02:01 PM
rcprito Re: rows.count vs column.count 03-08-2013, 02:06 PM
Norie Re: rows.count vs column.count 03-08-2013, 02:09 PM
rcprito Re: rows.count vs column.count 03-08-2013, 02:12 PM
Norie Re: rows.count vs column.count 03-08-2013, 02:31 PM
  1. #1
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    rows.count vs column.count

    hey guys.

    This for counting rows.

    rcnt = Folha10.Range("A" & rows.Count).End(xlUp).row

    How is it to count columns ?

    Thanks

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: rows.count vs column.count

    If you mean find the last column.
    rcnt = Folha10.Cells(1, Columns.Count).End(xlToLeft).Column
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: rows.count vs column.count

    ccnt = Folha10.range("IV1").end(xltoleft).column
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: rows.count vs column.count

    Hmm, I think that it's not working.

    Can u check this out?

       If Extrusão.ComboBox6.Value = "Fino" Then
        
        k = 1
    
        Do While Folha10.Cells(1, 1 + k) <> "" '
    
        k = k + 1
    
        Loop
    
        Folha10.Cells(1, 1 + k) = Extrusão.ComboBox3.Value
        
        Dim rcnt50 As Long
        
        rcnt50 = Folha10.Cells(1, Columns.Count).End(xlToLeft).Column
        
        For i = 1 To rcnt50
        
        If Folha10.Cells("1" & i) = Extrusão.ComboBox3.Value Then
        Folha10.Cells(1, 1 + k) = ""
        End If
        Next
        End if
    I'm trying to say that if it's "Fino" then he should put data in Folha 10 (it's working).

    Then I was saying that if the value from combobox3 it's the same from the data already recorded he shouldn't save.

    Why isn't this working?

    Thanks

  5. #5
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: rows.count vs column.count

    another way
    Lastcol = ActiveSheet.UsedRange.Columns.Count
    If solved remember to mark Thread as solved

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: rows.count vs column.count

    This is wrong.
     If Folha10.Cells("1" & i) = Extrusão.ComboBox3.Value Then
    What are you trying to refer to with Cells("1" & I)?

    If you are trying to loop through the columns in row 1.
     If Folha10.Cells(1,  i) = Extrusão.ComboBox3.Value Then

  7. #7
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: rows.count vs column.count

    Well, I've changed, you were right. But now nothing appears in the sheet...


    If Extrusão.ComboBox6.Value = "Fino" Then
        
        k = 1
    
        Do While Folha10.Cells(1, 1 + k) <> "" '
    
        k = k + 1
    
        Loop
    
        Folha10.Cells(1, 1 + k) = Extrusão.ComboBox3.Value
        
        Dim rcnt50 As Long
        
        rcnt50 = Folha10.Cells(1, Columns.Count).End(xlToLeft).Column
        
        For i = 2 To rcnt50
        
        If Folha10.Cells(1, i) = Extrusão.ComboBox3.Value Then
        Folha10.Cells(1, 1 + k) = ""
        End If
        Next
        End If

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: rows.count vs column.count

    Have you stepped through the code to see what's happening?

  9. #9
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: rows.count vs column.count

    Well, yes.

    problem.jpg

    don't understand why isn't working..

    that's the only think that is not ok

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: rows.count vs column.count

    So what does happen/not happen when you step through the code?

    Perhaps you could attach a sample workbook?

  11. #11
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: rows.count vs column.count

    The problem it is in "unidadeextrusão" userform in commandbutton1 "unidade".

    Thanks
    Attached Files Attached Files

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: rows.count vs column.count

    So what is the problem?

    Are there errors?

    Is data going in the wrong place?

    What's actually supposed to happen?

    How can I test things?

  13. #13
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: rows.count vs column.count

    So the information should go to "Folha 10" and it doesn't go.

    no errors, only that problem.

    Data doesn't go anywhere.


    If I put this away
    Dim rcnt50 As Long
        
        rcnt50 = Folha10.Cells(1, Columns.Count).End(xlToLeft).Column
        
        For i = 2 To rcnt50
        
        If Folha10.Cells(1, i) = Extrusão.ComboBox3.Value Then
        Folha10.Cells(1, 1 + k) = ""
        End If
        Next
        End If
    it wrights in "folha10" but it can repeat the .values from the extrusão.combobox3 and I don't want that to happen!


    you can test things by using the "colaborador".

    in the first combobox that appears to you, choose "Fino". Then you can choose whatever you want...


    Thanks!

  14. #14
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: rows.count vs column.count

    Fino isn't listed in any of the comboboxes on the userform 'Colaborador'.

  15. #15
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: rows.count vs column.count

    Start from "Extrusão".

  16. #16
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: rows.count vs column.count

    When I start from that form and step through the code after clicking the 'Seguinte' button then things start getting strange here:
           If Folha7.Range("A" & i) = Colaborador.ComboBox1.Text Then
    What happens is that the reference to the closed form Colaborador triggers that form's Initialize event.

    If I keep on stepping through nothing really happens and both forms are unloaded.

  17. #17
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: rows.count vs column.count

    It's hard to explain to you the programm.

    Let me explaing what I want to do.

    I want to create a Sheet, where all the codes written in a combobox go there.

    Then, If one code is repeated, the programm don't add the code to another column. If the code is new it goes to a a new column.

    Did you get it ?

    Thanks

  18. #18
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: rows.count vs column.count

    I can understand what you are trying to do.

    It's the number of forms and what those forms do that's confusing.

    Also, there's seems to be quite a bit of referencing between forms, for example the code I just posted.

    Do you really need 8 userforms?

  19. #19
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: rows.count vs column.count

    They are connected with each other so I need them.

    But for that case I only need 2 userforms. "Extrusão" and "UnidadeExtrusão".

    The thing is that I don't understand why isn't that saving the codes.

  20. #20
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: rows.count vs column.count

    Sorry, I don't understand.

    Why do you need the forms to be separate?

    Would it not make sense to combine some of them?

  21. #21
    Registered User
    Join Date
    02-27-2013
    Location
    Porto
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: rows.count vs column.count

    I didn't send you all the programm. I can't !

    That's why it's not making sense to you all those userforms!

    But to solve my problem the userform combination is not an issue...

  22. #22
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: rows.count vs column.count

    Sorry, but I think it might be.

    Like I said when I try to step through the code another form is being loaded, which seems to be affecting what's going on.

    Have you stepped through the code that isn't working?

    Did you check all the values involved?

    Are there meant to be headers on 'Paletes - Extrusão Fino'?

+ 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