Excel dropdown to entire column

2019-09-09 22:14发布

How to copy a dropdown menu (data validation) to entire column in Excel (only rows that having something else too). And, in this case, how to leave row for the header?

3条回答
闹够了就滚
2楼-- · 2019-09-09 22:36
  1. Select the entire column you want to validate
  2. Click on "Data Validation" from the Data tab

    enter image description here

  3. Choose "List" from the "Allow" box

    enter image description here

  4. Click on the arrow to the right of the "Source" box and select the cells containing the allowed values

    enter image description here

And you are good to go!

More on that here.

查看更多
仙女界的扛把子
3楼-- · 2019-09-09 22:54

To copy and paste only the dropdown list (validation), and only to not empty cells, do the following:

  1. Select every possible cell (including empty ones) where you want to have the dropdown menu pasted.

  2. Hit F5, then Special..., finally Constants radio button and OK. This will select only cells which are not empty from your previous selection.

  3. Home > Paste > Paste Special...

  4. Validation radio button and lastly OK.

Let me know if it helps!

查看更多
男人必须洒脱
4楼-- · 2019-09-09 23:02

Ok, I found the answer and now it's working:

Sub pasteCellToColumn()
    Dim lastRow As Long, i As Long

    lastRow = Sheets("Sheet1").Cells(Rows.Count, 2).End(xlUp).Row
    Sheets("hiddenData").Range("A1").Copy

    For i = 1 To lastRow
        If Len(Trim(Sheets("Sheet1").Range("A" & i).Value)) <> 0 Then
        Sheets("Sheet1").Range("K" & i).PasteSpecial _
        Paste:=xlPasteValidation
        End If
    Next i

End Sub
查看更多
登录 后发表回答