• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

User select cells one sheet, vba fill corresponding cells on background sheet

Littleme

New Member
Hello again!
I'm stumped again...

Like the title says, I want users to select cell range on sheet1, but code fills corresponding cells on sheet2 with value "1". Conditional formatting then reflects this on sheet1. (Trying to keep sheet1 free from calculations as to not scare user)

Any takers?

Code:
Sub Heltid()
With Application
  .ScreenUpdating = False
  .EnableEvents = False
  .Calculation = xlCalculationManual
End With

  Dim SelRange As Range
  Set SelRange = Selection
  
For Each cell In SelRange
cell.Value = "1" * 1
Next
With Application
  .ScreenUpdating = True
  .EnableEvents = True
  .Calculation = xlCalculationAutomatic
End With
End Sub
 
I'm not sure whether you're wanting to fill Sheet2 with the number 1, or the text string 1, but you can modify this code either way.

Best to just do the change in one shot. :)
Code:
Sub Example()
Dim myRange As Range

Set myRange = Selection
Worksheets("Sheet2").Range(myRange.Address).Value = 1

End Sub
 
Back
Top