davidanaya11579
New Member
- Joined
- Dec 26, 2017
- Messages
- 11
Hello Geniuses! I am creating a form and trying to make it as user friendly as possible, creating command buttons that will automatically copy all formulas and data validations from the current line, and insert them in the desired row (same sheet). For some reason, this isn’t copying my formulas, just the data validations?? Below is what I have so far:
Private Sub CommandButton2_Click()
Dim varUserInput As Variant
varUserInput = InputBox("Enter Row Number where you want to add a row:", _
"What Row?")
If varUserInput = "" Then Exit Sub
rowNum = varUserInput
Rows(rowNum & ":" & rowNum).Insert Shift:=xlDown
Rows(rowNum - 1 & ":" & rowNum - 1).Copy Range("A" & rowNum)
Range(rowNum & ":" & rowNum).ClearContents
End Sub
Private Sub CommandButton2_Click()
Dim varUserInput As Variant
varUserInput = InputBox("Enter Row Number where you want to add a row:", _
"What Row?")
If varUserInput = "" Then Exit Sub
rowNum = varUserInput
Rows(rowNum & ":" & rowNum).Insert Shift:=xlDown
Rows(rowNum - 1 & ":" & rowNum - 1).Copy Range("A" & rowNum)
Range(rowNum & ":" & rowNum).ClearContents
End Sub