Hola grupo:
Tengo el siguiente código:
Sub Reporte()
Application.ScreenUpdating = False
Dim wksCli As Worksheet, wksFic As Worksheet
Dim rngO As Range, rngArea As Range
Dim lngFilas As Long, n As Long
ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
ActiveSheet.Name = "Reporte"
Range("A1:D1").Font.Bold = True
Range("A1").Value = "Fecha"
Range("B1").Value = "Inicio"
Range("C1").Value = "Fin"
Range("D1").Value = "Folio"
j = ActiveCell.Row + 1
Worksheets("Hoja de Servicio").Activate
Set wksCli = Worksheets("Hoja de Servicio")
Set wksFic = Worksheets("Reporte")
Set rngO = Selection
If ActiveSheet.Name <> "Hoja de Servicio" Then Exit Sub
For Each rngArea In rngO.Areas
lngFilas = lngFilas + rngArea.Rows.Count
Next rngArea
MsgBox ("Se generará reporte de " & lngFilas & " registros.")
For Each rngArea In rngO.Areas
For n = 1 To rngArea.Rows.Count
With wksFic
.Cells(j, 1).Value =
Format(wksCli.Cells(rngArea.Rows(n).Row, 58), "mm/dd/yyyy")
.Cells(j, 2).Value =
Format(wksCli.Cells(rngArea.Rows(n).Row, 62), "hh:mm:ss")
.Cells(j, 3).Value =
Format(wksCli.Cells(rngArea.Rows(n).Row, 89), "hh:mm:ss")
.Cells(j, 4).Value = wksCli.Cells(rngArea.Rows(n).Row, 59)
j = j + 1
.Cells(j, 1).Value = "Reporte para: " &
wksCli.Cells(rngArea.Rows(n).Row, 60)
j = j + 1
.Cells(j, 1).Value = "Justificación: " &
wksCli.Cells(rngArea.Rows(n).Row, 63)
j = j + 1
.Cells(j, 1).Value = "Solicita: " &
wksCli.Cells(rngArea.Rows(n).Row, 66) & "; " & _
wksCli.Cells(rngArea.Rows(n).Row, 68)
j = j + 1
.Cells(j, 1).Value = wksCli.Cells(rngArea.Rows(n).Row, 87)
j = j + 1
End With
Next n
Next rngArea
Set rngArea = Nothing
Set rngO = Nothing
Set wksFic = Nothing
Set wksCli = Nothing
Application.ScreenUpdating = False
'
End Sub
Cuando paso los valores de wksCli a wksFic, necesito poner los cuatro
primeros valores en negritas. He estado intentando con las propiedades de
range() y cells() pero no me funciona.
La siguiente línea de código: .Cells(j, 1).Value =
wksCli.Cells(rngArea.Rows(n).Row, 87); el valor del origen
wksCli.Cells(rngArea.Rows(n).Row, 87) contiene varias lineas en la celda, y
necesito que cuando aplique el reporte me deje el destino en formato general.
Ahí no tengo ni la mas remota idea de cómo hacerlo.
Hasta ahora, genero el reporte y el formato lo hago manual. ¿me puede ayudar
con esto?
Saludos
Leer las respuestas