Skip to main content

How to paste values to visible/filtered cells only in Excel?

Author: Sun Last Modified: 2024-11-14

In Excel, if you have filtered data or hidden some cells, and when you paste values into the filtered or hidden range, the hidden cells will be also filled with pasted values. Here I will tell you some tricks to paste values to visible cells only in Excel.

Paste values to visible cells with VBA

Paste values to visible cells with Paste to Visible Range of Kutools for Excel good idea3


Paste values to visible cells with VBA

In Excel, there is no other ways to solve this problem except VBA.

1. Press Alt + F11 keys simultaneously, and a Microsoft Visual Basic for Applications window pops.

2. Click Insert > Module, then paste below VBA code to the popping Module window.

VBA: Paste values to visible cells only.

Sub CopyFilteredCells()
	'Updateby20150203
	Dim rng1 As Range
	Dim rng2 As Range
	Dim InputRng As Range
	Dim OutRng As Range
	xTitleId     = "KutoolsforExcel"
	Set InputRng = Application.Selection
	Set InputRng = Application.InputBox("Copy Range :", xTitleId, InputRng.Address, Type: = 8)
	Set OutRng   = Application.InputBox("Paste Range:", xTitleId, Type: = 8)
	For Each rng1 In InputRng
		rng1.Copy
		For Each rng2 In OutRng
			If rng2.EntireRow.RowHeight > 0 Then
				rng2.PasteSpecial
				Set OutRng = rng2.Offset(1).Resize(OutRng.Rows.Count)
				Exit For
			End If
		Next
	Next
	Application.CutCopyMode = False
End Sub

3. Click F5 key or the Run button, then a dialog is popping out for you to select values to copy. See screenshot:
vba code to select cells to copy

4. After selecting values, click OK, then another dialog pops out to select a range to paste the selected data. See screenshot:
 vba code to select a range to paste the selected data

5. Click OK. You can see only the visible cells are pasted the selected values.


Paste values to visible cells with Paste to Visible Range of Kutools for Excel

Actually, if you use Paste to Visible Range utility of Kutools for Excel – a handy Excel tool, you can quickly and easily solve the problem of pasting values to visible range.
Paste values to visible cells

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Enhanced with AI capabilities, Kutools automates tasks with precision, making data management effortless. Detailed information of Kutools for Excel...         Free trial...

After installing Kutools for Excel, please do as below:(Free Download Kutools for Excel Now!)

1. Select a range of values you want to copy and paste, then click Kutools > Range > Paste to Visible Range > All or Only Paste Values. See screenshot:
click Kutools > Range > Paste to Visible Range

2. Then a Paste to Visible Range dialog pops out, and select the range you want to paste the values. See screenshot:
 select the range to paste the values

3. Click OK. Now the selected values are pasted into the visible range only.

Paste only values to visible cells Paste all to visible cells
Paste only values to visible cells Paste all to visible cells


Note:
This utility both work on hidden and filtered rows or columns

Click here for more detail information about Paste to Visible Range utility.

  Paste to Visible Cells Only

 

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!