hey guys.
This for counting rows.
rcnt = Folha10.Range("A" & rows.Count).End(xlUp).row
How is it to count columns ?
Thanks
hey guys.
This for counting rows.
rcnt = Folha10.Range("A" & rows.Count).End(xlUp).row
How is it to count columns ?
Thanks
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.
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]
Hmm, I think that it's not working.
Can u check this out?
I'm trying to say that if it's "Fino" then he should put data in Folha 10 (it's working).![]()
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
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
another way
![]()
Lastcol = ActiveSheet.UsedRange.Columns.Count
If solved remember to mark Thread as solved
This is wrong.
What are you trying to refer to with Cells("1" & I)?![]()
If Folha10.Cells("1" & i) = Extrusão.ComboBox3.Value Then
If you are trying to loop through the columns in row 1.
![]()
If Folha10.Cells(1, i) = Extrusão.ComboBox3.Value Then
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
Have you stepped through the code to see what's happening?
Well, yes.
problem.jpg
don't understand why isn't working..
that's the only think that is not ok
So what does happen/not happen when you step through the code?
Perhaps you could attach a sample workbook?
The problem it is in "unidadeextrusão" userform in commandbutton1 "unidade".
Thanks
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?
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 awayit wrights in "folha10" but it can repeat the .values from the extrusão.combobox3 and I don't want that to happen!![]()
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
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!
Fino isn't listed in any of the comboboxes on the userform 'Colaborador'.
Start from "Extrusão".
When I start from that form and step through the code after clicking the 'Seguinte' button then things start getting strange here:
What happens is that the reference to the closed form Colaborador triggers that form's Initialize event.![]()
If Folha7.Range("A" & i) = Colaborador.ComboBox1.Text Then
If I keep on stepping through nothing really happens and both forms are unloaded.
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
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?
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.
Sorry, I don't understand.
Why do you need the forms to be separate?
Would it not make sense to combine some of them?
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...
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'?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks