How do i Trigger macros automatcially for sheet 2 when value change occur in sheet 1

jackbhai

New Member
Joined
May 19, 2019
Messages
18
I have Sheet 1 and Sheet
Sheet 1 => https://paste.pics/6d48d50d54592eb1bdcb31e727b44958
Sheet 2 => https://paste.pics/80f4230bf6819a80ed36e1b6415ece08
[h=2]Value of Sheet 1 => F5 => '50' => is referenced in Sheet 2 => E4 => '50'[/h]
[h=3]When i enter Value in Sheet 1 in place of F5 => Value gets Change in Sheet 2 => E4 => Automatically[/h]
[h=5]Now the issue is [/h][h=5]I want to print the DATA 1 and DATA 2 of Sheet 2 => That many times => how much value which is shown in place of Sheet 2 => E4 [Position] => in place of COLUMN => 'I' and 'J'[/h]
Like this Below Output :
https://paste.pics/494c856d2908a83ca031ee20bb706a09

My code which partially which print only one Column output but need to PRINT 'RAM' and 'RAJ' => COLUMN => 'I' and 'J'

Module :
Sub mac()
Dim ws As Worksheet
Dim rDest As Range
Dim lCount As Long
Dim sValue As String
Set ws = ThisWorkbook.Sheets("Sheet2")
Set rDest = ws.Range("I2")
With ws.Range(rDest, ws.Cells(ws.Rows.Count, rDest.Column).End(xlUp))
If .Row >= rDest.Row Then .ClearContents
End With
lCount = Val(ws.Range("E4").Value)
sValue = ws.Range("E8").Value
If lCount > 0 Then rDest.Resize(lCount) = sValue
End Sub

Code for Sheet 1 : to enable call => of macros => mac
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Sheets("Sheet1").Range("F5"), Target) Is Nothing Then
Call mac
End If
End Sub
 
@Fluff

Could you be able to see another post

I tried your Code

But Not Working

For Different approach for another scenario but not working !!!

"for Deleting DATA"
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,216,096
Messages
6,128,809
Members
449,468
Latest member
AGreen17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top