luishmafernandes Posted May 19, 2009 at 08:03 AM Report #265276 Posted May 19, 2009 at 08:03 AM Bom dia, Necessito de ajuda. Tenho uma tabela que tem três colunas (A-Nome, B-Valor e C-Cont) A coluna Cont, identifica o nº de valores que cada utilizador tem (existe utilizadores que não têm valores). A minha dificuldade é inserir linhas, abaixo do contador. Exemplo: O Rui tem um valor 12 e tem 3 contagens, então deveria inserir duas linhas abaixo (com o mesmo conteudo da seleccionada). Nome Valor Cont Luis 12 Rui12 3 Teresa 18 Manuel 18 1 Rita 12 Vasco 12
jpaulino Posted May 19, 2009 at 08:15 AM Report #265278 Posted May 19, 2009 at 08:15 AM Não entendi muito bem... Se tens isto: Luis |12| Rui |12|3 teresa|18| Queres que fique assim ? Luis |12| Rui |12|3 Rui |12|3 Rui |12|3 teresa|18| ou seja o count é para repetir as linhas ?
luishmafernandes Posted May 19, 2009 at 12:34 PM Author Report #265345 Posted May 19, 2009 at 12:34 PM É exactamente isso. Obrigado
luishmafernandes Posted May 20, 2009 at 07:05 AM Author Report #265669 Posted May 20, 2009 at 07:05 AM Help, agradeço a vossa ajuda.
jpaulino Posted May 20, 2009 at 07:22 AM Report #265672 Posted May 20, 2009 at 07:22 AM Estranho ... pensava que tinha respondido! O que já tens feito ? Basicamente é um ciclo até encontrar um valor na coluna C. Ao encontrar, copia o número de linhas de acordo com o valor que está na coluna.
luishmafernandes Posted June 22, 2009 at 09:14 PM Author Report #274243 Posted June 22, 2009 at 09:14 PM Consegui encontrar o que queria B), mas gostava de saber se posso copiar o conteúdo das células? Junto envio o código que utilizei: Private Sub CommandButton1_Click() Dim FirstRow As Long Dim LastRow As Long Dim iRow As Long Dim wks As Worksheet Set wks = ActiveSheet With wks FirstRow = 2 LastRow = .Cells(.Rows.Count, "D").End(xlUp).Row For iRow = LastRow To FirstRow Step -1 With .Cells(iRow, "D") If IsNumeric(.Value) Then If .Value > 1 Then .Offset(1, 0).Resize(.Value).EntireRow.Insert End If End If End With Next iRow End With End Sub
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now