M
Mekinnik
I am trying to create vb code to search column 'M' of sheet 'ProCode' and
find all the rows that match the value of Me.CbxDept.text. With this data I
would then like to programactilly like to copy the data cell by cell and row
by row to the sheet that another code has created. The reason for copying
cell by cell is due to the sheet being copied to is formatted with merged
cells. This is what I have already.
Private Sub BtnGo_Click()
Dim WSNew As Worksheet
'Dim rng As Range
Dim T As String
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
'creates a new sheet from the master sheet
T = Me.CbxDept.Text
Sheets("MASTER").Copy before:=Sheets(2)
Set WSNew = ActiveSheet
'creates the name of 'WSNew'
WSNew.name = T
'assigns cell 'J2' equal to 'T'
WSNew.Cells(2, 10) = T
'copies all data that matches 'T' to new sheet
With Application
..ScreenUpdating = True
..EnableEvents = True
End With
End Sub
find all the rows that match the value of Me.CbxDept.text. With this data I
would then like to programactilly like to copy the data cell by cell and row
by row to the sheet that another code has created. The reason for copying
cell by cell is due to the sheet being copied to is formatted with merged
cells. This is what I have already.
Private Sub BtnGo_Click()
Dim WSNew As Worksheet
'Dim rng As Range
Dim T As String
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
'creates a new sheet from the master sheet
T = Me.CbxDept.Text
Sheets("MASTER").Copy before:=Sheets(2)
Set WSNew = ActiveSheet
'creates the name of 'WSNew'
WSNew.name = T
'assigns cell 'J2' equal to 'T'
WSNew.Cells(2, 10) = T
'copies all data that matches 'T' to new sheet
With Application
..ScreenUpdating = True
..EnableEvents = True
End With
End Sub