Skip to content

Instantly share code, notes, and snippets.

@al-codaio
al-codaio / msexcel_fill_values_down.vba
Last active October 31, 2021 02:01
Fill cell value down until a new cell value occurs - VBA script for Microsoft Excel
' VBA script to take a value in column A and fill it down until a new value shows up in a cell for Microsoft Excel
' Author: Al Chen (al@coda.io)
' Last Updated: September 6th, 2020
' Video tutorial: https://youtu.be/t-32QkyjKVE?t=1109
Sub fillValuesDown()
Dim lastRow As Double
lastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row
Dim currentRange As Variant: Set currentRange = ActiveSheet.Range("A2:A" & lastRow)
ReDim newRange(1 To lastRow)
@al-codaio
al-codaio / google_sheets_fill_values_down.js
Last active February 20, 2023 17:53
Fill cell value down until a new cell value occurs - Google Apps Script for Google Sheets
// Google Apps Script to take a value in column A and fill it down until a new value shows up in a cell for Google Sheets
// Author: Al Chen (al@coda.io)
// Last Updated: September 6th, 2020
// Video tutorial: https://youtu.be/t-32QkyjKVE?t=106
function fillValuesDown() {
var spreadsheet = SpreadsheetApp.getActive()
var currentRange = spreadsheet.getRange("A2:A" + spreadsheet.getLastRow())
var newRange = []
var newFillValue