I want to insert different values in each worksheet i.e every worksheet should 've different values.I tried the below code but i m not able to set the
range for a particular worksheet
For ex-For Sheet1 iwant to set the range as "A1:A4" with values as 10,20,30,40
But don't know how to set this for different cells.
Similarly For Sheet2 iwant to set the range as "b1:b4" with values as 100,200,300,400
If a workbook contains 10 such sheets how do i set the code
Attached below is my code
Public Sub my1()
Dim WS_Count As Integer
Dim cs As String
cs = ActiveSheet.Nam e
Dim r As Range
Dim ws As Worksheet
Dim y As Integer
y = 1
Dim I As Integer
For Each ws In ThisWorkbook.Wo rksheets
ws.Activate
If cs = "Sheet1" Then
Set r = ActiveSheet.Ran ge("A1:A4")
r.Cells.Value = "10:20:30:4 0"
Else
Set r = ActiveSheet.Ran ge("c1:c4")
r.Cells.Value = "100:200:300:40 0"
End If
Next ws
I m not able to get the proper result with the above code...Can anyone Plz guide me...
range for a particular worksheet
For ex-For Sheet1 iwant to set the range as "A1:A4" with values as 10,20,30,40
But don't know how to set this for different cells.
Similarly For Sheet2 iwant to set the range as "b1:b4" with values as 100,200,300,400
If a workbook contains 10 such sheets how do i set the code
Attached below is my code
Public Sub my1()
Dim WS_Count As Integer
Dim cs As String
cs = ActiveSheet.Nam e
Dim r As Range
Dim ws As Worksheet
Dim y As Integer
y = 1
Dim I As Integer
For Each ws In ThisWorkbook.Wo rksheets
ws.Activate
If cs = "Sheet1" Then
Set r = ActiveSheet.Ran ge("A1:A4")
r.Cells.Value = "10:20:30:4 0"
Else
Set r = ActiveSheet.Ran ge("c1:c4")
r.Cells.Value = "100:200:300:40 0"
End If
Next ws
I m not able to get the proper result with the above code...Can anyone Plz guide me...
Comment